From a8d51f1806c075e002aba05244eca9ed73a82c25 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 5 Nov 2012 11:18:52 +0000 Subject: [PATCH] 2012-11-05 Sergio Martin * include/functions_graph.php: Fixed a bug of the events/alerts/unwknown period calculation git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7127 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions_graph.php | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f54c294b0e..59f6b2f368 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-11-05 Sergio Martin + + * include/functions_graph.php: Fixed a bug of the events/alerts/unwknown + period calculation + 2012-11-05 Sergio Martin * include/help/en/help_alert_macros.php diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 430b270b2e..4b315d9e85 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -223,7 +223,9 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i global $config; global $chart_extra_data; global $series_type; + global $max_value; + $max_value = 0; $flash_chart = $config['flash_charts']; // Event iterator @@ -261,6 +263,10 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i $data_i++; } + if($max_value < $interval_max) { + $max_value = $interval_max; + } + // Data in the interval if ($count > 0) { $total /= $count; @@ -447,6 +453,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, global $warning_min; global $critical_min; global $graphic_type; + global $max_value; $chart = array(); $color = array(); @@ -600,7 +607,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $graph_stats = get_statwin_graph_statistics($chart); // Fix event and alert scale - $event_max = $max_value * 1.05; + $event_max = 10 + (float)$max_value * 1.05; foreach ($chart as $timestamp => $chart_data) { if ($show_events && $chart_data['event'.$series_suffix] > 0) { $chart[$timestamp]['event'.$series_suffix] = $event_max * 1.2; @@ -2948,6 +2955,10 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $j++; } + if($max_value < $count) { + $max_value = $count; + } + // Read events and alerts that fall in the current interval $event_value = 0; $alert_value = 0; @@ -3006,7 +3017,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $graph_stats = get_statwin_graph_statistics($chart); // Fix event and alert scale - $event_max = $max_value * 1.05; + $event_max = 2 + (float)$max_value * 1.05; foreach ($chart as $timestamp => $chart_data) { if ($chart_data['event'] > 0) { $chart[$timestamp]['event'] = $event_max;