From df43c25f45c8cbc40a3a0fe760a6a99c064c84b4 Mon Sep 17 00:00:00 2001 From: Esteban Sanchez Date: Wed, 11 Mar 2009 14:09:53 +0000 Subject: [PATCH] 2009-03-11 Esteban Sanchez * include/functions_reporting.php: Fixed an error on get_group_stats() that gives wrong monitor status count because it was counting some modules twice. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1523 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ pandora_console/include/functions_reporting.php | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b8e312d722..2f37836779 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2009-03-11 Esteban Sanchez + + * include/functions_reporting.php: Fixed an error on get_group_stats() + that gives wrong monitor status count because it was counting some + modules twice. + 2009-03-10 Evi Vanoost * include/functions_visual_map: Small fixes to render backgrounds with diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c67c7ac7ae..6ecdf79ba5 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -40,7 +40,7 @@ function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max if (empty ($period)) { global $config; - $period = $config["sla_period"]; + $period = $config["sla_period"]; } $datelimit = $date - $period; // start date @@ -127,8 +127,8 @@ function get_group_stats ($id_group = 0) { $data["monitor_checks"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter); $data["monitor_not_init"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp = 0"); $data["monitor_unknown"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND UNIX_TIMESTAMP() - utimestamp >= current_interval * 2"); - $data["monitor_critical"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND estado = 1"); - $data["monitor_warning"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND estado = 2"); + $data["monitor_critical"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND estado = 1 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2"); + $data["monitor_warning"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND estado = 2 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2"); $data["monitor_ok"] = $data["monitor_checks"] - $data["monitor_not_init"] - $data["monitor_unknown"] - $data["monitor_critical"] - $data["monitor_warning"]; $sql = sprintf ("SELECT times_fired FROM talert_template_modules WHERE id_agent_module IN (%s)", implode (",", array_keys ($agents))); @@ -153,7 +153,7 @@ function get_group_stats ($id_group = 0) { $data["total_alerts"] = $data["monitor_alerts"] + $data["monitor_alerts_fired"]; $data["total_alerts_fired"] = $data["monitor_alerts_fired"]; $data["total_alerts_fire_count"] = $data["monitor_alerts_fire_count"]; - $data["monitor_bad"] = $data["monitor_critical"] + $data["monitor_unknown"] +$data["monitor_warning"]; + $data["monitor_bad"] = $data["monitor_critical"] + $data["monitor_unknown"] + $data["monitor_warning"]; $data["total_bad"] = $data["monitor_bad"]; $data["total_not_init"] = $data["monitor_not_init"]; $data["total_down"] = $data["monitor_critical"]; @@ -169,6 +169,7 @@ function get_group_stats ($id_group = 0) { */ if ($data["monitor_bad"] > 0 && $data["monitor_checks"] > 0) { + echo $data["monitor_bad"].' / '.$data["monitor_checks"]; $data["monitor_health"] = format_numeric (100 - ($data["monitor_bad"] / ($data["monitor_checks"] / 100)), 1); } else { $data["monitor_health"] = 100;