2010-07-28 Ramon Novoa <rnovoa@artica.es>

* include/fgraph.php: Async modules are not compressed. Fixed charts
          for these modules.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3075 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2010-07-28 15:23:50 +00:00
parent 310dcb6f0e
commit f244d38ba8
2 changed files with 166 additions and 79 deletions

View File

@ -1,3 +1,8 @@
2010-07-28 Ramon Novoa <rnovoa@artica.es>
* include/fgraph.php: Async modules are not compressed. Fixed charts
for these modules.
2010-07-28 Miguel de Dios <miguel.dedios@artica.es> 2010-07-28 Miguel de Dios <miguel.dedios@artica.es>
* install.php: fixed unclose bold tag. * install.php: fixed unclose bold tag.

View File

@ -157,6 +157,14 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$agent_id = get_agent_id ($agent_name); $agent_id = get_agent_id ($agent_name);
$module_name = get_agentmodule_name ($agent_module_id); $module_name = get_agentmodule_name ($agent_module_id);
$module_name_list[$i] = $agent_name." / ".substr ($module_name, 0, 20); $module_name_list[$i] = $agent_name." / ".substr ($module_name, 0, 20);
$id_module_type = get_agentmodule_type ($agent_module_id);
$module_type = get_moduletype_name ($id_module_type);
if (strstr($module_type, 'async') !== false || strstr($module_type, 'log4x') !== false) {
$async_module = true;
$avg_only = 1;
} else {
$async_module = false;
}
// Get event data (contains alert data too) // Get event data (contains alert data too)
if ($show_events == 1 || $show_alerts == 1) { if ($show_events == 1 || $show_alerts == 1) {
@ -182,27 +190,36 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$data = array (); $data = array ();
} }
// Get previous data // Uncompressed module data
$previous_data = get_previous_data ($agent_module_id, $datelimit); if ($async_module) {
if ($previous_data !== false) { $min_necessary = 1;
$previous_data['utimestamp'] = $datelimit;
array_unshift ($data, $previous_data); // Compressed module data
} else {
// Get previous data
$previous_data = get_previous_data ($agent_module_id, $datelimit);
if ($previous_data !== false) {
$previous_data['utimestamp'] = $datelimit;
array_unshift ($data, $previous_data);
}
// Get next data
$nextData = get_next_data ($agent_module_id, $date);
if ($nextData !== false) {
array_push ($data, $nextData);
} else if (count ($data) > 0) {
// Propagate the last known data to the end of the interval
$nextData = array_pop ($data);
array_push ($data, $nextData);
$nextData['utimestamp'] = $date;
array_push ($data, $nextData);
}
$min_necessary = 2;
} }
// Get next data
$nextData = get_next_data ($agent_module_id, $date);
if ($nextData !== false) {
array_push ($data, $nextData);
} else if (count ($data) > 0) {
// Propagate the last known data to the end of the interval
$nextData = array_pop ($data);
array_push ($data, $nextData);
$nextData['utimestamp'] = $date;
array_push ($data, $nextData);
}
// Check available data // Check available data
if (count ($data) < 2) { if (count ($data) < $min_necessary) {
continue; continue;
} }
@ -277,7 +294,11 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else { } else {
$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i]; if ($async_module) {
$graph_values[$i][$timestamp] = 0;
} else {
$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i];
}
} }
} }
} }
@ -1271,6 +1292,14 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$agent_name = get_agentmodule_agent_name ($agent_module_id); $agent_name = get_agentmodule_agent_name ($agent_module_id);
$agent_id = get_agent_id ($agent_name); $agent_id = get_agent_id ($agent_name);
$module_name = get_agentmodule_name ($agent_module_id); $module_name = get_agentmodule_name ($agent_module_id);
$id_module_type = get_agentmodule_type ($agent_module_id);
$module_type = get_moduletype_name ($id_module_type);
if (strstr($module_type, 'async') !== false || strstr($module_type, 'log4x') !== false) {
$async_module = true;
$avg_only = 1;
} else {
$async_module = false;
}
// Get event data (contains alert data too) // Get event data (contains alert data too)
if ($show_events == 1 || $show_alerts == 1) { if ($show_events == 1 || $show_alerts == 1) {
@ -1295,28 +1324,37 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
if ($data === false) { if ($data === false) {
$data = array (); $data = array ();
} }
// Get previous data // Uncompressed module data
$previous_data = get_previous_data ($agent_module_id, $datelimit); if ($async_module) {
if ($previous_data !== false) { $min_necessary = 1;
$previous_data['utimestamp'] = $datelimit;
array_unshift ($data, $previous_data); // Compressed module data
} } else {
// Get previous data
// Get next data $previous_data = get_previous_data ($agent_module_id, $datelimit);
$nextData = get_next_data ($agent_module_id, $date); if ($previous_data !== false) {
if ($nextData !== false) { $previous_data['utimestamp'] = $datelimit;
array_push ($data, $nextData); array_unshift ($data, $previous_data);
} else if (count ($data) > 0) { }
// Propagate the last known data to the end of the interval
$nextData = array_pop ($data); // Get next data
array_push ($data, $nextData); $nextData = get_next_data ($agent_module_id, $date);
$nextData['utimestamp'] = $date; if ($nextData !== false) {
array_push ($data, $nextData); array_push ($data, $nextData);
} else if (count ($data) > 0) {
// Propagate the last known data to the end of the interval
$nextData = array_pop ($data);
array_push ($data, $nextData);
$nextData['utimestamp'] = $date;
array_push ($data, $nextData);
}
$min_necessary = 2;
} }
// Check available data // Check available data
if (count ($data) < 2) { if (count ($data) < $min_necessary) {
if (!$graphic_type) { if (!$graphic_type) {
return fs_error_image (); return fs_error_image ();
} }
@ -1405,9 +1443,15 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else { } else {
$chart[$timestamp]['sum'] = $previous_data; if ($async_module) {
$chart[$timestamp]['min'] = $previous_data; $chart[$timestamp]['sum'] = 0;
$chart[$timestamp]['max'] = $previous_data; $chart[$timestamp]['min'] = 0;
$chart[$timestamp]['max'] = 0;
} else {
$chart[$timestamp]['sum'] = $previous_data;
$chart[$timestamp]['min'] = $previous_data;
$chart[$timestamp]['max'] = $previous_data;
}
} }
$chart[$timestamp]['count'] = 0; $chart[$timestamp]['count'] = 0;
@ -1492,7 +1536,15 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$agent_name = get_agentmodule_agent_name ($agent_module_id); $agent_name = get_agentmodule_agent_name ($agent_module_id);
$agent_id = get_agent_id ($agent_name); $agent_id = get_agent_id ($agent_name);
$module_name = get_agentmodule_name ($agent_module_id); $module_name = get_agentmodule_name ($agent_module_id);
$id_module_type = get_agentmodule_type ($agent_module_id);
$module_type = get_moduletype_name ($id_module_type);
if (strstr($module_type, 'async') !== false || strstr($module_type, 'log4x') !== false) {
$async_module = true;
$avg_only = 1;
} else {
$async_module = false;
}
// Get event data (contains alert data too) // Get event data (contains alert data too)
if ($show_events == 1 || $show_alerts == 1) { if ($show_events == 1 || $show_alerts == 1) {
$events = get_db_all_rows_filter ('tevento', $events = get_db_all_rows_filter ('tevento',
@ -1517,27 +1569,36 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$data = array (); $data = array ();
} }
// Get previous data // Uncompressed module data
$previous_data = get_previous_data ($agent_module_id, $datelimit); if ($async_module) {
if ($previous_data !== false) { $min_necessary = 1;
$previous_data['utimestamp'] = $datelimit;
array_unshift ($data, $previous_data);
}
// Get next data // Compressed module data
$nextData = get_next_data ($agent_module_id, $date); } else {
if ($nextData !== false) { // Get previous data
array_push ($data, $nextData); $previous_data = get_previous_data ($agent_module_id, $datelimit);
} else if (count ($data) > 0) { if ($previous_data !== false) {
// Propagate the last known data to the end of the interval $previous_data['utimestamp'] = $datelimit;
$nextData = array_pop ($data); array_unshift ($data, $previous_data);
array_push ($data, $nextData); }
$nextData['utimestamp'] = $date;
array_push ($data, $nextData); // Get next data
$nextData = get_next_data ($agent_module_id, $date);
if ($nextData !== false) {
array_push ($data, $nextData);
} else if (count ($data) > 0) {
// Propagate the last known data to the end of the interval
$nextData = array_pop ($data);
array_push ($data, $nextData);
$nextData['utimestamp'] = $date;
array_push ($data, $nextData);
}
$min_necessary = 2;
} }
// Check available data // Check available data
if (count ($data) < 2) { if (count ($data) < $min_necessary) {
if (!$graphic_type) { if (!$graphic_type) {
return fs_error_image (); return fs_error_image ();
} }
@ -1626,7 +1687,11 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else { } else {
$chart[$timestamp]['sum'] = $previous_data; if ($async_module) {
$chart[$timestamp]['sum'] = 0;
} else {
$chart[$timestamp]['sum'] = $previous_data;
}
} }
$chart[$timestamp]['count'] = 0; $chart[$timestamp]['count'] = 0;
@ -1733,7 +1798,15 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$agent_name = get_agentmodule_agent_name ($agent_module_id); $agent_name = get_agentmodule_agent_name ($agent_module_id);
$agent_id = get_agent_id ($agent_name); $agent_id = get_agent_id ($agent_name);
$module_name = get_agentmodule_name ($agent_module_id); $module_name = get_agentmodule_name ($agent_module_id);
$id_module_type = get_agentmodule_type ($agent_module_id);
$module_type = get_moduletype_name ($id_module_type);
if (strstr($module_type, 'async') !== false || strstr($module_type, 'log4x') !== false) {
$async_module = true;
$avg_only = 1;
} else {
$async_module = false;
}
// Get event data (contains alert data too) // Get event data (contains alert data too)
if ($show_events == 1 || $show_alerts == 1) { if ($show_events == 1 || $show_alerts == 1) {
$events = get_db_all_rows_filter ('tevento', $events = get_db_all_rows_filter ('tevento',
@ -1758,27 +1831,36 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$data = array (); $data = array ();
} }
// Get previous data // Uncompressed module data
$previous_data = get_previous_data ($agent_module_id, $datelimit, 1); if ($async_module) {
if ($previous_data !== false) { $min_necessary = 1;
$previous_data['utimestamp'] = $datelimit;
array_unshift ($data, $previous_data);
}
// Get next data // Compressed module data
$nextData = get_next_data ($agent_module_id, $date, 1); } else {
if ($nextData !== false) { // Get previous data
array_push ($data, $nextData); $previous_data = get_previous_data ($agent_module_id, $datelimit, 1);
} else if (count ($data) > 0) { if ($previous_data !== false) {
// Propagate the last known data to the end of the interval $previous_data['utimestamp'] = $datelimit;
$nextData = array_pop ($data); array_unshift ($data, $previous_data);
array_push ($data, $nextData); }
$nextData['utimestamp'] = $date;
array_push ($data, $nextData); // Get next data
$nextData = get_next_data ($agent_module_id, $date, 1);
if ($nextData !== false) {
array_push ($data, $nextData);
} else if (count ($data) > 0) {
// Propagate the last known data to the end of the interval
$nextData = array_pop ($data);
array_push ($data, $nextData);
$nextData['utimestamp'] = $date;
array_push ($data, $nextData);
}
$min_necessary = 2;
} }
// Check available data // Check available data
if (count ($data) < 2) { if (count ($data) < $min_necessary) {
if (!$graphic_type) { if (!$graphic_type) {
return fs_error_image (); return fs_error_image ();
} }