Add new options when render proc is active. Tiquet: #2503

This commit is contained in:
m-lopez-f 2015-07-22 12:16:10 +02:00
parent 575aedb6f7
commit 68b6120609
5 changed files with 28 additions and 9 deletions

View File

@ -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 '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);

View File

@ -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);
}

View File

@ -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

View File

@ -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"]);

View File

@ -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"]);