webui: Allow user to display ok/warning/critical alerts only (#7484)

* Allow user to display ok/warning/critical alerts only

* Update alerts.inc.php

* Update alerts.inc.php
This commit is contained in:
Ryan Medlyn
2017-10-15 12:50:55 -06:00
committed by Neil Lathwood
parent 2f2234da70
commit 62867a6661
2 changed files with 14 additions and 8 deletions

View File

@@ -10,14 +10,17 @@ $alert_states = array(
'alerted' => 1,
'acknowledged' => 2,
'worse' => 3,
'better' => 4
'better' => 4,
);
$alert_severities = array(
// alert_rules.status is enum('ok','warning','critical')
'ok' => 1,
'warning' => 2,
'critical' => 3
'critical' => 3,
'ok only' => 4,
'warning only' => 5,
'critical only' => 6,
);
$show_recovered = false;
@@ -45,7 +48,7 @@ if (isset($_POST['min_severity'])) {
$min_severity_id = $alert_severities[$_POST['min_severity']];
}
if (isset($min_severity_id)) {
$where .= " AND `alert_rules`.`severity` >= ".$min_severity_id;
$where .= " AND `alert_rules`.`severity` ".($min_severity_id > 3 ? "" :">")."= ".($min_severity_id > 3 ? $min_severity_id - 3 : $min_severity_id);
}
}