diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index 672033c4c9..969ec1177d 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -283,8 +283,20 @@ if ($get_module_detail) {
$data[] = io_safe_input($row[$attr[0]]);
}
else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type']) ) {
-
- $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
+
+ 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[] = (double) $row[$attr[0]];
}
else {
if ($row[$attr[0]] == '') {
@@ -909,12 +921,34 @@ if ($list_modules) {
$salida = $config["render_proc_fail"];
break;
default:
- $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision']));
+ 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;
+ }
break;
}
}
else {
- $salida = remove_right_zeros(number_format($module["datos"], $config['graph_precision']));
+ 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;
+ }
}
// Show units ONLY in numeric data types
if (isset($module["unit"])) {
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 94442111e6..c3d5a5279a 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -247,6 +247,32 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands
return format_numeric ($number, $decimals). $shorts[$pos]; //This will actually do the rounding and the decimals
}
+function human_milliseconds_to_string($seconds) {
+ $ret = "";
+
+ /*** get the days ***/
+ $days = intval(intval($seconds) / (360000*24));
+ if($days > 0)
+ $ret .= "$days days ";
+
+ /*** get the hours ***/
+ $hours = (intval($seconds) / 360000) % 24;
+ if($hours > 0)
+ $ret .= "$hours hours ";
+
+ /*** get the minutes ***/
+ $minutes = (intval($seconds) / 6000) % 60;
+ if($minutes > 0)
+ $ret .= "$minutes minutes ";
+
+ /*** get the seconds ***/
+ $seconds = intval($seconds / 100) % 60;
+ if ($seconds > 0)
+ $ret .= "$seconds seconds";
+
+ return $ret;
+}
+
/**
* Rounds an integer to a multiple of 5.
*
diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php
index 92ac82caa7..e7c62edde8 100755
--- a/pandora_console/include/functions_treeview.php
+++ b/pandora_console/include/functions_treeview.php
@@ -182,20 +182,53 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
$data = "" . $config["render_proc_fail"] . "";
}
break;
+ default:
+ //~ if (is_numeric($last_data["datos"]))
+ //~ $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 = "" . format_numeric($last_data["datos"]) . "";
+ else
+ $data = "" . substr(io_safe_output($last_data['datos']),0,12) . "";
+ break;
+ default:
+ if (is_numeric($last_data["datos"]))
+ $data = "" . format_numeric($last_data["datos"]) . "";
+ 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 = "" . format_numeric($last_data["datos"]) . "";
+ else
+ $data = "" . substr(io_safe_output($last_data['datos']),0,12) . "";
+ break;
default:
if (is_numeric($last_data["datos"]))
$data = "" . format_numeric($last_data["datos"]) . "";
else
$data = "" . substr(io_safe_output($last_data['datos']),0,12) . "";
- break;
+ break;
}
}
- else {
- if (is_numeric($last_data["datos"]))
- $data = "" . format_numeric($last_data["datos"]) . "";
- else
- $data = "" . substr(io_safe_output($last_data['datos']),0,12) . "";
- }
+
if (!empty($last_data['utimestamp'])) {
$last_data_str = $data;