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,6 +190,12 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$data = array (); $data = array ();
} }
// Uncompressed module data
if ($async_module) {
$min_necessary = 1;
// Compressed module data
} else {
// Get previous data // Get previous data
$previous_data = get_previous_data ($agent_module_id, $datelimit); $previous_data = get_previous_data ($agent_module_id, $datelimit);
if ($previous_data !== false) { if ($previous_data !== false) {
@ -201,8 +215,11 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
array_push ($data, $nextData); array_push ($data, $nextData);
} }
$min_necessary = 2;
}
// Check available data // Check available data
if (count ($data) < 2) { if (count ($data) < $min_necessary) {
continue; continue;
} }
@ -276,11 +293,15 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$graph_values[$i][$timestamp] = $total * $weight_list[$i]; $graph_values[$i][$timestamp] = $total * $weight_list[$i];
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else {
if ($async_module) {
$graph_values[$i][$timestamp] = 0;
} else { } else {
$graph_values[$i][$timestamp] = $previous_data * $weight_list[$i]; $graph_values[$i][$timestamp] = $previous_data * $weight_list[$i];
} }
} }
} }
}
for ($i = 0; $i < $module_number; $i++) { for ($i = 0; $i < $module_number; $i++) {
if ($weight_list[$i] != 1) if ($weight_list[$i] != 1)
@ -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) {
@ -1296,6 +1325,12 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$data = array (); $data = array ();
} }
// Uncompressed module data
if ($async_module) {
$min_necessary = 1;
// Compressed module data
} else {
// Get previous data // Get previous data
$previous_data = get_previous_data ($agent_module_id, $datelimit); $previous_data = get_previous_data ($agent_module_id, $datelimit);
if ($previous_data !== false) { if ($previous_data !== false) {
@ -1315,8 +1350,11 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
array_push ($data, $nextData); 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 ();
} }
@ -1404,11 +1442,17 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$chart[$timestamp]['max'] = $interval_max; $chart[$timestamp]['max'] = $interval_max;
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else {
if ($async_module) {
$chart[$timestamp]['sum'] = 0;
$chart[$timestamp]['min'] = 0;
$chart[$timestamp]['max'] = 0;
} else { } else {
$chart[$timestamp]['sum'] = $previous_data; $chart[$timestamp]['sum'] = $previous_data;
$chart[$timestamp]['min'] = $previous_data; $chart[$timestamp]['min'] = $previous_data;
$chart[$timestamp]['max'] = $previous_data; $chart[$timestamp]['max'] = $previous_data;
} }
}
$chart[$timestamp]['count'] = 0; $chart[$timestamp]['count'] = 0;
$chart[$timestamp]['timestamp_bottom'] = $timestamp; $chart[$timestamp]['timestamp_bottom'] = $timestamp;
@ -1492,6 +1536,14 @@ 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) {
@ -1517,6 +1569,12 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$data = array (); $data = array ();
} }
// Uncompressed module data
if ($async_module) {
$min_necessary = 1;
// Compressed module data
} else {
// Get previous data // Get previous data
$previous_data = get_previous_data ($agent_module_id, $datelimit); $previous_data = get_previous_data ($agent_module_id, $datelimit);
if ($previous_data !== false) { if ($previous_data !== false) {
@ -1536,8 +1594,11 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
array_push ($data, $nextData); 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 ();
} }
@ -1625,9 +1686,13 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$chart[$timestamp]['sum'] = $total; $chart[$timestamp]['sum'] = $total;
$previous_data = $total; $previous_data = $total;
// Compressed data // Compressed data
} else {
if ($async_module) {
$chart[$timestamp]['sum'] = 0;
} else { } else {
$chart[$timestamp]['sum'] = $previous_data; $chart[$timestamp]['sum'] = $previous_data;
} }
}
$chart[$timestamp]['count'] = 0; $chart[$timestamp]['count'] = 0;
$chart[$timestamp]['timestamp_bottom'] = $timestamp; $chart[$timestamp]['timestamp_bottom'] = $timestamp;
@ -1733,6 +1798,14 @@ 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) {
@ -1758,6 +1831,12 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$data = array (); $data = array ();
} }
// Uncompressed module data
if ($async_module) {
$min_necessary = 1;
// Compressed module data
} else {
// Get previous data // Get previous data
$previous_data = get_previous_data ($agent_module_id, $datelimit, 1); $previous_data = get_previous_data ($agent_module_id, $datelimit, 1);
if ($previous_data !== false) { if ($previous_data !== false) {
@ -1777,8 +1856,11 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
array_push ($data, $nextData); 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 ();
} }