diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index b33ac7fdfa..d6ad8bca8f 100755 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -260,6 +260,31 @@ define ('STATUS_SERVER_OK', 'server_ok.png'); define ('STATUS_SERVER_DOWN', 'server_down.png'); +/* Status images (ball) */ +//For modules +define ('STATUS_MODULE_OK_BALL', 'module_ok_ball.png'); +define ('STATUS_MODULE_CRITICAL_BALL', 'module_critical_ball.png'); +define ('STATUS_MODULE_WARNING_BALL', 'module_warning_ball.png'); +define ('STATUS_MODULE_NO_DATA_BALL', 'module_no_data_ball.png'); +define ('STATUS_MODULE_UNKNOWN_BALL', 'module_unknown_ball.png'); +//For agents +define ('STATUS_AGENT_CRITICAL_BALL', 'agent_critical_ball.png'); +define ('STATUS_AGENT_WARNING_BALL', 'agent_warning_ball.png'); +define ('STATUS_AGENT_DOWN_BALL', 'agent_down_ball.png'); +define ('STATUS_AGENT_UNKNOWN_BALL', 'agent_unknown_ball.png'); +define ('STATUS_AGENT_OK_BALL', 'agent_ok_ball.png'); +define ('STATUS_AGENT_NO_DATA_BALL', 'agent_no_data_ball.png'); +define ('STATUS_AGENT_NO_MONITORS_BALL', 'agent_no_monitors_ball.png'); +define ('STATUS_AGENT_NOT_INIT_BALL', 'agent_notinit_ball.png'); +//For alerts +define ('STATUS_ALERT_FIRED_BALL', 'alert_fired_ball.png'); +define ('STATUS_ALERT_NOT_FIRED_BALL', 'alert_not_fired_ball.png'); +define ('STATUS_ALERT_DISABLED_BALL', 'alert_disabled_ball.png'); +//For servers +define ('STATUS_SERVER_OK_BALL', 'server_ok_ball.png'); +define ('STATUS_SERVER_DOWN_BALL', 'server_down_ball.png'); + + /* Events criticity */ define ('EVENT_CRIT_MAINTENANCE', 0); diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 9bc2cbc8ec..da7cbc39aa 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -2028,6 +2028,18 @@ function agents_tree_view_alert_img ($alert_fired) { } } +//Returns the alert ball image to display tree view + +function agents_tree_view_alert_img_ball ($alert_fired) { + + if ($alert_fired) { + return ui_print_status_image (STATUS_ALERT_FIRED_BALL, __('Alert fired'), true); + } + else { + return ui_print_status_image (STATUS_ALERT_NOT_FIRED_BALL, __('Alert not fired'), true); + } +} + //Returns the status image to display tree view function agents_tree_view_status_img ($critical, $warning, $unknown, $total, $notinit) { @@ -2048,7 +2060,33 @@ function agents_tree_view_status_img ($critical, $warning, $unknown, $total, $no __('At least one module is in UKNOWN status'), true); } else { - return ui_print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true); + return ui_print_status_image (STATUS_AGENT_OK, + __('All Monitors OK'), true); + } +} + +//Returns the status ball image to display tree view + +function agents_tree_view_status_img_ball ($critical, $warning, $unknown, $total, $notinit) { + if ($total == 0 || $total == $notinit) { + return ui_print_status_image (STATUS_AGENT_NO_MONITORS_BALL, + __('No Monitors'), true); + } + if ($critical > 0) { + return ui_print_status_image (STATUS_AGENT_CRITICAL_BALL, + __('At least one module in CRITICAL status'), true); + } + else if ($warning > 0) { + return ui_print_status_image (STATUS_AGENT_WARNING_BALL, + __('At least one module in WARNING status'), true); + } + else if ($unknown > 0) { + return ui_print_status_image (STATUS_AGENT_DOWN_BALL, + __('At least one module is in UKNOWN status'), true); + } + else { + return ui_print_status_image (STATUS_AGENT_OK_BALL, + __('All Monitors OK'), true); } }