diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index a559911435..52fbaf9bd5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2008-06-23 Esteban Sanchez + + * include/functions_reporting.php: Do not show alert tables if there's + no fired alerts in the alert report. Use get_agents_in_group() in + general_group_reporting() and agents_detailed_reporting(). + 2008-06-23 Esteban Sanchez * include/functions_db.php: Deleted a debug output. list_group2 marked diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index cc9008bcdb..6b1c992b4d 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -298,34 +298,33 @@ function alert_reporting ($id_group, $period = 0, $date = 0, $return = false) { $output .= ''.lang_string ('fired_alerts').': '.sizeof ($alerts_fired).'
'; $output .= ''.lang_string ('total_alerts_monitored').': '.sizeof ($alerts).'
'; - $table->width = '100%'; - $table->class = 'databox'; - $table->size = array (); - $table->size[0] = '100px'; - $table->data = array (); - $table->head = array (); - $table->head[0] = lang_string ('agent'); - $table->head[1] = lang_string ('alert_description'); - $table->head[2] = lang_string ('times_fired'); - $table->head[3] = lang_string ('priority'); - $table->align = array (); - $table->align[2] = 'center'; - - foreach ($agents as $alerts) { - $data = array (); - foreach ($alerts as $alert) { - if (! isset ($data[0])) - $data[0] = ''.dame_nombre_agente_agentemodulo ($alert['id_agente_modulo']).''; - else - $data[0] = ''; - $data[1] = $alert['descripcion']; - $data[2] = $alerts_fired[$alert['id_aam']]; - $data[3] = get_alert_priority ($alert['priority']); - array_push ($table->data, $data); + if ($alerts_fired) { + $table->width = '100%'; + $table->class = 'databox'; + $table->size = array (); + $table->size[0] = '100px'; + $table->data = array (); + $table->head = array (); + $table->head[0] = lang_string ('agent'); + $table->head[1] = lang_string ('alert_description'); + $table->head[2] = lang_string ('times_fired'); + $table->head[3] = lang_string ('priority'); + + foreach ($agents as $alerts) { + $data = array (); + foreach ($alerts as $alert) { + if (! isset ($data[0])) + $data[0] = ''.dame_nombre_agente_agentemodulo ($alert['id_agente_modulo']).''; + else + $data[0] = ''; + $data[1] = $alert['descripcion']; + $data[2] = $alerts_fired[$alert['id_aam']]; + $data[3] = get_alert_priority ($alert['priority']); + array_push ($table->data, $data); + } } + $output .= print_table ($table, true); } - $output .= print_table ($table, true); - if (!$return) echo $output; return $output; @@ -420,8 +419,8 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return = */ function general_group_reporting ($id_group, $return = false) { $output = ''; - $agents = get_db_value ('COUNT(*)', 'tagente', 'id_grupo', $id_group); - $output .= ''.lang_string ('agents_in_group').': '.$agents.'
'; + $agents = get_agents_in_group ($id_group); + $output .= ''.lang_string ('agents_in_group').': '.sizeof ($agents).'
'; if (!$return) echo $output; @@ -438,7 +437,7 @@ function general_group_reporting ($id_group, $return = false) { */ function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return = false) { $output = ''; - $agents = get_db_value ('COUNT(*)', 'tagente', 'id_grupo', $id_group); + $agents = get_agents_in_group ($id_group); $table_modules->width = '750px'; $table_alerts->width = '750px';