diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 0147168ebf..b14ad3e7b2 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1342,6 +1342,73 @@ function get_priority_name($priority) } +/** + * Translates status into string. + * + * @param integer $status Agent status. + * + * @return string Translation. + */ +function get_agent_status_string($status) +{ + switch ($status) { + case AGENT_STATUS_CRITICAL: + return __('CRITICAL'); + + case AGENT_STATUS_WARNING: + return __('WARNING'); + + case AGENT_STATUS_ALERT_FIRED: + return __('ALERT FIRED'); + + case AGENT_STATUS_NOT_INIT: + return __('NO DATA'); + + case AGENT_STATUS_NORMAL: + return __('NORMAL'); + + case AGENT_STATUS_UNKNOWN: + default: + return __('UNKNOWN'); + } +} + + +/** + * Translates status into string. + * + * @param integer $status Module status. + * + * @return string Translation. + */ +function get_module_status_string($status) +{ + switch ($status) { + case AGENT_MODULE_STATUS_CRITICAL_BAD: + return __('CRITICAL'); + + case AGENT_MODULE_STATUS_WARNING_ALERT: + case AGENT_MODULE_STATUS_CRITICAL_ALERT: + return __('ALERT FIRED'); + + case AGENT_MODULE_STATUS_WARNING: + return __('WARNING'); + + case AGENT_MODULE_STATUS_UNKNOWN: + return __('UNKNOWN'); + + case AGENT_MODULE_STATUS_NO_DATA: + case AGENT_MODULE_STATUS_NOT_INIT: + return __('NO DATA'); + + case AGENT_MODULE_STATUS_NORMAL_ALERT: + case AGENT_MODULE_STATUS_NORMAL: + default: + return __('NORMAL'); + } +} + + /** * Get priority class (CSS class) from priority value. * diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 8ba751042c..8bad693c3d 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -19,17 +19,18 @@ require_once $config['homedir'].'/include/functions.php'; require_once $config['homedir'].'/include/functions_modules.php'; -require_once $config['homedir'].'/include/functions_users.php';/** - * Return the agent if exists in the DB. - * - * @param integer $id_agent The agent id. - * @param boolean $show_disabled Show the agent found althought it is disabled. By default false. - * @param boolean $force_meta - * - * @return boolean The result to check if the agent is in the DB. - */ +require_once $config['homedir'].'/include/functions_users.php'; +/** + * Return the agent if exists in the DB. + * + * @param integer $id_agent The agent id. + * @param boolean $show_disabled Show the agent found althought it is disabled. By default false. + * @param boolean $force_meta + * + * @return boolean The result to check if the agent is in the DB. + */ function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false) { $agent = db_get_row_filter( diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index eb4a5186bf..df5146711c 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -88,7 +88,7 @@ if (is_ajax()) { if ($get_agents_group_json) { $id_group = (int) get_parameter('id_group'); - $recursion = (bool) get_parameter('recursion'); + $recursion = (get_parameter_switch('recursion', 'false') === 'true'); $id_os = get_parameter('id_os', ''); $agent_name = get_parameter('name', '');