From cd676cac5920f85265b9e576d244dea74b5783d4 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Fri, 31 Jul 2015 11:16:42 +0200 Subject: [PATCH] change in the way data show snmp data timeticks. Tiquet: #2494 --- pandora_console/include/ajax/module.php | 48 +++++++++++++++++-- pandora_console/include/functions_modules.php | 2 + .../operation/agentes/status_monitor.php | 48 +++++++++++++++++-- 3 files changed, 90 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index a72b1456a2..9a4c04cbcb 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -274,13 +274,35 @@ if ($get_module_detail) { // Just a string of alphanumerical data... just do print //Fixed the data from Selenium Plugin if ($row[$attr[0]] != strip_tags($row[$attr[0]])) { + $data[] = io_safe_input($row[$attr[0]]); } - else if (is_numeric($row[$attr[0]])) { + else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) { + $data[] = (double) $row[$attr[0]]; } else { - $data[] = $row[$attr[0]]; + + $intDays = $row[$attr[0]] / 8640000; + $dias = $intDays - (integer)$intDays; + $intDays = (integer)$intDays; + + $intHours = $dias * 24; + $Hours = $intHours - (integer)$intHours; + $intHours = (integer)$intHours; + + $intMinutes = $Hours * 60; + $minutos = $intMinutes - (integer)$intMinutes; + $intMinutes = (integer)$intMinutes; + + $intSeconds = $minutos * 60; + $ConvertSeconds = $intDays . " Days - ". $intHours ." Hours - ". $intMinutes . " Mins"; + if ($ConvertSeconds) { + $data[] = $ConvertSeconds; + } + else { + $data[] = $row[$attr[0]]; + } } } } @@ -969,7 +991,27 @@ if ($list_modules) { if ($module_value == $sub_string) { - $salida = $module_value; + $intDays = $module_value / 8640000; + $dias = $intDays - (integer)$intDays; + $intDays = (integer)$intDays; + + $intHours = $dias * 24; + $Hours = $intHours - (integer)$intHours; + $intHours = (integer)$intHours; + + $intMinutes = $Hours * 60; + $minutos = $intMinutes - (integer)$intMinutes; + $intMinutes = (integer)$intMinutes; + + $intSeconds = $minutos * 60; + $ConvertSeconds = $intDays . " Days - ". $intHours ." Hours - ". $intMinutes . " Mins"; + + if ($ConvertSeconds) { + $salida = $ConvertSeconds; + } + else { + $salida = $module_value; + } } else { $salida = " $data) { $values[$key]["module_name"] = $module_name; $values[$key]["agent_id"] = $agent_id; $values[$key]["agent_name"] = $agent_name; + $values[$key]["module_type"] = $module_type; } if ($search_in_history_db) { diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index ce81b2901d..05b65c7508 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1229,8 +1229,8 @@ foreach ($result as $row) { $data[8] = ui_print_module_warn_value($row['max_warning'], $row['min_warning'], $row['str_warning'], $row['max_critical'], $row['min_critical'], $row['str_critical']); - - if (is_numeric($row["datos"])) { + + if (is_numeric($row["datos"]) && !modules_is_string_type($row['module_type'])) { if ( $config["render_proc"] ) { switch($row["module_type"]) { case 2: @@ -1256,7 +1256,7 @@ foreach ($result as $row) { // Show units ONLY in numeric data types if (isset($row["unit"])) { - $salida .= " " . ''. io_safe_output($row["unit"]) . ''; + $salida .= " " . '' . io_safe_output($row["unit"]) . ''; $salida = ui_print_truncate_text($salida, 'agent_small', true, true, false, '[…]', 'font-size:7.5pt;'); } } @@ -1292,7 +1292,26 @@ foreach ($result as $row) { $sub_string = substr(io_safe_output($row["datos"]), 0, 12); if ($module_value == $sub_string) { - $salida = $module_value; + $intDays = $module_value / 8640000; + $dias = $intDays - (integer)$intDays; + $intDays = (integer)$intDays; + + $intHours = $dias * 24; + $Hours = $intHours - (integer)$intHours; + $intHours = (integer)$intHours; + + $intMinutes = $Hours * 60; + $minutos = $intMinutes - (integer)$intMinutes; + $intMinutes = (integer)$intMinutes; + + $intSeconds = $minutos * 60; + $ConvertSeconds = $intDays . " Days - ". $intHours ." Hours - ". $intMinutes . " Mins"; + if ($ConvertSeconds) { + $salida = $ConvertSeconds; + } + else { + $salida = $module_value; + } } else { //Fixed the goliat sends the strings from web @@ -1314,7 +1333,26 @@ foreach ($result as $row) { if ($module_value == $sub_string) { - $salida = $module_value; + $intDays = $module_value / 8640000; + $dias = $intDays - (integer)$intDays; + $intDays = (integer)$intDays; + + $intHours = $dias * 24; + $Hours = $intHours - (integer)$intHours; + $intHours = (integer)$intHours; + + $intMinutes = $Hours * 60; + $minutos = $intMinutes - (integer)$intMinutes; + $intMinutes = (integer)$intMinutes; + + $intSeconds = $minutos * 60; + $ConvertSeconds = $intDays . " Days - ". $intHours ." Hours - ". $intMinutes . " Mins"; + if ($ConvertSeconds) { + $salida = $ConvertSeconds; + } + else { + $salida = $module_value; + } } else { $salida = "