From d59379cf8c6347483b8749d8959287f8acf32d7f Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 2 Mar 2011 16:16:09 +0000 Subject: [PATCH] 2011-03-02 Miguel de Dios * include/functions_reporting.php: added the call to "get_agentmodule_status" without check the alerts status for the color. * include/functions_db.php: in function "get_agentmodule_status" added new parameter "$without_alerts" flag for check without alerts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4049 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ pandora_console/include/functions_db.php | 11 +++++++---- pandora_console/include/functions_reporting.php | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d364d68431..56c2192600 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-03-02 Miguel de Dios + + * include/functions_reporting.php: added the call to + "get_agentmodule_status" without check the alerts status for the color. + + * include/functions_db.php: in function "get_agentmodule_status" added new + parameter "$without_alerts" flag for check without alerts. + 2011-03-02 Miguel de Dios * include/db/postgresql.php, include/db/mysql.php, include/functions.php: diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index e83ede525a..f7b442cc4c 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2594,16 +2594,19 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal * Get the status of an agent module. * * @param int Id agent module to check. + * @param bool $without_alerts The flag to check only the module, by default false. * * @return int Module status. Value 4 means that some alerts assigned to the * module were fired. */ -function get_agentmodule_status($id_agentmodule = 0) { +function get_agentmodule_status($id_agentmodule = 0, $without_alerts = false) { $current_timestamp = get_system_time (); - $times_fired = get_db_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); - if ($times_fired > 0) { - return 4; // Alert fired + if (!$without_alerts) { + $times_fired = get_db_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); + if ($times_fired > 0) { + return 4; // Alert fired + } } $status_row = get_db_row ("tagente_estado", "id_agente_modulo", $id_agentmodule); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 95b302d0bb..9789cd1d12 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1549,9 +1549,9 @@ function get_agent_module_info ($id_agent, $filter = false) { foreach ($modules as $key => $module) { $return["modules"]++; - $module_status = get_agentmodule_status($key); + $module_status = get_agentmodule_status($key, true); - switch($module_status){ + switch ($module_status) { case 0: $return["monitor_normal"]++; break;