Fixed an error which affected to the values of the custom graphs

This commit is contained in:
Alejandro Gallardo Escobar 2016-05-25 17:20:54 +02:00
parent 100819d9a5
commit 6ba9531c51

View File

@ -1381,12 +1381,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$datelimit = $date - $period; $datelimit = $date - $period;
foreach ($module_list as $module) { foreach ($module_list as $module) {
$temp[$module] = modules_get_agentmodule($module); $temp[$module] = modules_get_agentmodule($module);
$temp_data = db_get_value_sql('SELECT datos $query_last_value = sprintf('
FROM tagente_datos SELECT datos
WHERE id_agente_modulo = ' . (int) $module . FROM tagente_datos
' AND utimestamp > ' . (int) $datelimit . WHERE id_agente_modulo = %d
' AND utimestamp < ' . (int) $date) . AND utimestamp < %d
" ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC',
$module, $date);
$temp_data = db_get_value_sql($query_last_value);
if ($temp_data) { if ($temp_data) {
if (is_numeric($temp_data)) if (is_numeric($temp_data))
@ -1403,9 +1405,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$temp[$module]['value'] = $value; $temp[$module]['value'] = $value;
$temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date); $temp[$module]['max'] = reporting_get_agentmodule_data_max($module,$period,$date);
$temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date); $temp[$module]['min'] = reporting_get_agentmodule_data_min($module,$period,$date);
} }
break; break;
case CUSTOM_GRAPH_HBARS: case CUSTOM_GRAPH_HBARS:
case CUSTOM_GRAPH_VBARS: case CUSTOM_GRAPH_VBARS:
@ -1414,12 +1414,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$label = ''; $label = '';
foreach ($module_list as $module) { foreach ($module_list as $module) {
$module_data = modules_get_agentmodule($module); $module_data = modules_get_agentmodule($module);
$temp_data = db_get_value_sql('SELECT datos $query_last_value = sprintf('
FROM tagente_datos SELECT datos
WHERE id_agente_modulo = ' . (int) $module . FROM tagente_datos
' AND utimestamp > ' . (int) $datelimit . WHERE id_agente_modulo = %d
' AND utimestamp < ' . (int) $date) . AND utimestamp < %d
" ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC',
$module, $date);
$temp_data = db_get_value_sql($query_last_value);
$agent_name = io_safe_output( $agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($module)); modules_get_agentmodule_agent_name ($module));
@ -1429,7 +1431,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else else
$label = $agent_name . " - " .$module_data['nombre']; $label = $agent_name . " - " .$module_data['nombre'];
$temp[$label]['g'] = round($temp_data,4); $temp[$label]['g'] = round($temp_data,4);
} }
break; break;
case CUSTOM_GRAPH_PIE: case CUSTOM_GRAPH_PIE:
@ -1437,12 +1438,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$total_modules = 0; $total_modules = 0;
foreach ($module_list as $module) { foreach ($module_list as $module) {
$data_module = modules_get_agentmodule($module); $data_module = modules_get_agentmodule($module);
$temp_data = db_get_value_sql('SELECT datos $query_last_value = sprintf('
FROM tagente_datos SELECT datos
WHERE id_agente_modulo = ' . (int) $module . FROM tagente_datos
' AND utimestamp > ' . (int) $datelimit . WHERE id_agente_modulo = %d
' AND utimestamp < ' . (int) $date) . AND utimestamp < %d
" ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC',
$module, $date);
$temp_data = db_get_value_sql($query_last_value);
if ( $temp_data ){ if ( $temp_data ){
if (is_numeric($temp_data)) if (is_numeric($temp_data))
$value = $temp_data; $value = $temp_data;
@ -1469,12 +1472,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$datelimit = $date - $period; $datelimit = $date - $period;
foreach ($module_list as $module) { foreach ($module_list as $module) {
$temp[$module] = modules_get_agentmodule($module); $temp[$module] = modules_get_agentmodule($module);
$temp_data = db_get_value_sql('SELECT datos $query_last_value = sprintf('
FROM tagente_datos SELECT datos
WHERE id_agente_modulo = ' . (int) $module . FROM tagente_datos
' AND utimestamp > ' . (int) $datelimit . WHERE id_agente_modulo = %d
' AND utimestamp < ' . (int) $date) . AND utimestamp < %d
" ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC',
$module, $date);
$temp_data = db_get_value_sql($query_last_value);
if ( $temp_data ) { if ( $temp_data ) {
if (is_numeric($temp_data)) if (is_numeric($temp_data))
$value = $temp_data; $value = $temp_data;