change in the way data show snmp data timeticks. Tiquet: #2494

This commit is contained in:
m-lopez-f 2015-07-31 11:16:42 +02:00
parent e8d5dfde06
commit cd676cac59
3 changed files with 90 additions and 8 deletions

View File

@ -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 = "<span " .

View File

@ -1676,11 +1676,13 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
$module_name = modules_get_agentmodule_name ($id_agent_module);
$agent_id = modules_get_agentmodule_agent ($id_agent_module);
$agent_name = modules_get_agentmodule_agent_name ($id_agent_module);
$module_type = modules_get_agentmodule_type ($id_agent_module);
foreach ($values as $key => $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) {

View File

@ -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 .= "&nbsp;" . '<i>'. io_safe_output($row["unit"]) . '</i>';
$salida .= "&nbsp;" . '<i>' . io_safe_output($row["unit"]) . '</i>';
$salida = ui_print_truncate_text($salida, 'agent_small', true, true, false, '[&hellip;]', '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 = "<span " .