From d8cf061a30b720f211729c0caf8044c974aceaa9 Mon Sep 17 00:00:00 2001 From: laf Date: Thu, 26 Feb 2015 12:08:42 +0000 Subject: [PATCH] Added alert details to alert page --- html/includes/print-alerts.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/html/includes/print-alerts.php b/html/includes/print-alerts.php index b576936f3..6d46c61f2 100644 --- a/html/includes/print-alerts.php +++ b/html/includes/print-alerts.php @@ -64,6 +64,14 @@ $full_query = $full_query . $query . " LIMIT $start,$results"; foreach( dbFetchRows($full_query, $param) as $alert ) { $rule = dbFetchRow("SELECT * FROM alert_rules WHERE id = ? LIMIT 1", array($alert['rule_id'])); + $log = dbFetchCell("SELECT details FROM alert_log WHERE rule_id = ? AND device_id = ? ORDER BY id DESC LIMIT 1", array($alert['rule_id'],$alert['device_id'])); + $log_detail = json_decode(gzuncompress($log),true); + foreach( $log_detail['rule'][0] as $k=>$v ) { + if( !empty($v) && $k != 'device_id' && (stristr($k,'id') || stristr($k,'desc')) && substr_count($k,'_') <= 1 ) { + $fault_detail .= $k.' => '.$v."; "; + } + } + $ico = "ok"; $col = "green"; $extra = ""; @@ -86,7 +94,7 @@ foreach( dbFetchRows($full_query, $param) as $alert ) { echo ""; echo "#".((int) $rulei++).""; echo "".htmlentities($rule['name']).""; - echo "".$alert['hostname'].""; + echo "".$alert['hostname'].""; echo "".($alert['timestamp'] ? $alert['timestamp'] : "N/A").""; echo "".$rule['severity']; if($alert['state'] == 3) {