From 68b6120609a52321534878f0e8c4c8beb947747e Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Wed, 22 Jul 2015 12:16:10 +0200 Subject: [PATCH] Add new options when render proc is active. Tiquet: #2503 --- pandora_console/godmode/setup/setup_visuals.php | 9 ++++++++- pandora_console/include/functions_config.php | 17 ++++++++++++++--- pandora_console/include/functions_modules.php | 3 ++- .../operation/agentes/estado_monitores.php | 4 ++-- .../operation/agentes/status_monitor.php | 4 ++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index b95ad63fe7..df7e000f39 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -492,7 +492,7 @@ $table->data[$row][1] = html_print_input_text ('custom_graph_widht', $row++; -$table->data[$row][0] = __('Display proc modules in binary format (OK/FAIL)'); +$table->data[$row][0] = __('Display data of proc modules in other format'); $table->data[$row][1] = __('Yes') . ' ' . html_print_radio_button ('render_proc', 1, '', $config["render_proc"], true) . @@ -502,6 +502,13 @@ $table->data[$row][1] .= __('No') . ' ' . $config["render_proc"], true); $row++; +$table->data[$row][0] = __('Display text proc modules have state is ok'); +$table->data[$row][1] = html_print_input_text ('render_proc_ok', $config["render_proc_ok"], '', 25, 25, true); +$row++; + +$table->data[$row][0] = __('Display text when proc modules have state critical'); +$table->data[$row][1] = html_print_input_text ('render_proc_fail', $config["render_proc_fail"], '', 25, 25, true); +$row++; echo '
'; html_print_input_hidden ('update_config', 1); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 37975e597d..d8d72ec193 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -454,8 +454,12 @@ function config_update_config () { $error_update[] = __('Show the group name instead the group icon.'); if (!config_update_value ('custom_graph_widht', get_parameter('custom_graph_widht'))) $error_update[] = __('Default line thickness for the Custom Graph.'); - if (!config_update_value ('render_proc', (int) get_parameter('render_proc', 0))) - $error_update[] = __('Display proc modules in binary format (OK/FAIL)'); + if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false))) + $error_update[] = __('Display data of proc modules in other format'); + if (!config_update_value ('render_proc_ok', (string) get_parameter('render_proc_ok', __('Ok') ))) + $error_update[] = __('Display text proc modules have state is ok'); + if (!config_update_value ('render_proc_fail', (string) get_parameter('render_proc_fail', __('Fail') ))) + $error_update[] = __('Display text when proc modules have state critical'); $interval_values = get_parameter ('interval_values'); @@ -1207,7 +1211,14 @@ function config_process_config () { if (!isset($config['render_proc'])) { config_update_value ('render_proc', 0); } - + + if (!isset($config["render_proc_ok"])) { + config_update_value ('render_proc_ok', __('Ok') ); + } + if (!isset($config["render_proc_fail"])) { + config_update_value ('render_proc_fail', __('Fail') ); + } + if (!isset($config['command_snapshot'])) { config_update_value ('command_snapshot', 1); } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 0519d2eb54..cc51478470 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1724,7 +1724,8 @@ function modules_get_agentmodule_data ($id_agent_module, $period, case 21: case 31: if ( $config["render_proc"] ) { - $sql = sprintf ("SELECT IF(datos >= 1, 'OK', 'FAIL') as data, utimestamp + $sql = sprintf ("SELECT IF(datos >= 1, '" . $config["render_proc_ok"] . + "', '" . $config["render_proc_fail"] . "') as data, utimestamp FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 777d55c714..4916547073 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -607,9 +607,9 @@ foreach ($modules as $module) { case 21: case 31: if ($module["datos"]>=1) - $salida ='OK'; + $salida = $config["render_proc_ok"]; else - $salida = 'FAIL'; + $salida = $config["render_proc_fail"]; break; default: $salida = format_numeric($module["datos"]); diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index fafbd0d55b..f4d19352c9 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1211,9 +1211,9 @@ foreach ($result as $row) { case 21: case 31: if ( $row["datos"] >= 1 ) - $salida ='OK'; + $salida = $config["render_proc_ok"]; else - $salida = 'FAIL'; + $salida = $config["render_proc_fail"]; break; default: $salida = format_numeric($row["datos"]);