From ebbba31d576ed893b4623dbe7edc010485be3ce6 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Fri, 28 Oct 2016 13:15:26 +0200 Subject: [PATCH] Remove code, Already exists this feature in pandora --- pandora_console/include/ajax/module.php | 42 ++----------------- .../include/functions_treeview.php | 40 +++--------------- .../operation/agentes/status_monitor.php | 26 +----------- 3 files changed, 11 insertions(+), 97 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 969ec1177d..283a08230d 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -284,18 +284,7 @@ if ($get_module_detail) { } else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) { - switch($row['module_type']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module_id); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $data[] = human_milliseconds_to_string($row['data']); - else - $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision'])); - break; - default: - $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision'])); - break; - } + $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision'])); //~ $data[] = (double) $row[$attr[0]]; } else { @@ -921,34 +910,12 @@ if ($list_modules) { $salida = $config["render_proc_fail"]; break; default: - switch($module['id_tipo_modulo']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $salida = human_milliseconds_to_string($module['datos']); - else - $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision'])); - break; - default: - $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision'])); - break; - } + $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision'])); break; } } else { - switch($module['id_tipo_modulo']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $salida = human_milliseconds_to_string($module['datos']); - else - $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision'])); - break; - default: - $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision'])); - break; - } + $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision'])); } // Show units ONLY in numeric data types if (isset($module["unit"])) { @@ -1076,9 +1043,6 @@ if ($list_modules) { unset ($table); unset ($table_data); - - - } if ($get_type) { diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 4e69636f4c..b7d5aaf564 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -187,40 +187,6 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = //~ $data = "" . format_numeric($last_data["datos"]) . ""; //~ else //~ $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; - switch($module['id_tipo_modulo']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $data = "" . human_milliseconds_to_string($last_data['datos']) . ""; - else - if (is_numeric($last_data["datos"])) - $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; - else - $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; - break; - default: - if (is_numeric($last_data["datos"])) - $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; - else - $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; - break; - } - break; - } - } - else { - switch($module['id_tipo_modulo']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $data = "" . human_milliseconds_to_string($last_data['datos']) . ""; - else - if (is_numeric($last_data["datos"])) - $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; - else - $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; - break; - default: if (is_numeric($last_data["datos"])) $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; else @@ -228,6 +194,12 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = break; } } + else { + if (is_numeric($last_data["datos"])) + $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; + else + $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; + } if (!empty($last_data['utimestamp'])) { $last_data_str = $data; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 711d814680..93d2a186a6 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1285,34 +1285,12 @@ if (!empty($result)) { $salida = $config['render_proc_fail']; break; default: - switch($row['module_type']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $row['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $salida = human_milliseconds_to_string($row['datos']); - else - $salida = format_numeric($row['datos']); - break; - default: - $salida = format_numeric($row['datos']); - break; - } + $salida = format_numeric($row['datos']); break; } } else { - switch($row['module_type']) { - case 15: - $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $row['id_agente_modulo']); - if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') - $salida = human_milliseconds_to_string($row['datos']); - else - $salida = format_numeric($row['datos']); - break; - default: - $salida = format_numeric($row['datos']); - break; - } + $salida = format_numeric($row['datos']); } // Show units ONLY in numeric data types