2009-03-11 Esteban Sanchez <estebans@artica.es>

* 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
This commit is contained in:
Esteban Sanchez 2009-03-11 14:09:53 +00:00
parent 98a8c2c7fb
commit df43c25f45
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2009-03-11 Esteban Sanchez <estebans@artica.es>
* 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 <vanooste@rcbi.rochester.edu>
* include/functions_visual_map: Small fixes to render backgrounds with

View File

@ -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;