diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e267b3f4cd..d23bc31243 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-08-16 Miguel de Dios + + * include/functions_graph.php, operation/agentes/stat_win.php: fixeds to + show always units, and now show only avg by default, and now run the + showing baseline again. + + Fixes: #3390113 + 2011-08-16 Juan Manuel Ramon * pandoradb.oracle.sql diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 331cf60b0c..d6fad32950 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -34,6 +34,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, global $config; global $graphic_type; + enterprise_include_once("include/functions_reporting.php"); + // Set variables if ($date == 0) $date = get_system_time(); $datelimit = $date - $period; @@ -122,19 +124,24 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, if ($data[0]['utimestamp'] == $datelimit) { $previous_data = $data[0]['datos']; $j++; - } else { + } + else { $previous_data = 0; } // Get baseline data - $baseline_data = array (); - if ($baseline == 1) { - $baseline_data = enterprise_hook ('reporting_enterprise_get_baseline', array ($agent_module_id, $period, $width, $height , $title, $unit_name, $date)); - if ($baseline_data === ENTERPRISE_NOT_HOOK) { - $baseline_data = array (); + if ($baseline) { + $baseline_data = array (); + if ($baseline == 1) { + $baseline_data = enterprise_hook ('reporting_enterprise_get_baseline', array ($agent_module_id, $period, $width, $height , $title, $unit_name, $date)); + if ($baseline_data === ENTERPRISE_NOT_HOOK) { + $baseline_data = array (); + } } } - + + $units = modules_get_unit($agent_module_id); + // Calculate chart data for ($i = 0; $i < $resolution; $i++) { $timestamp = $datelimit + ($interval * $i); @@ -210,20 +217,37 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, // Data if ($count > 0) { - $chart[$timestamp]['sum'] = $total; - $chart[$timestamp]['min'] = $interval_min; - $chart[$timestamp]['max'] = $interval_max; + if ($avg_only) { + $chart[$timestamp]['sum'] = $total; + } + else { + $chart[$timestamp]['sum'] = $total; + $chart[$timestamp]['min'] = $interval_min; + $chart[$timestamp]['max'] = $interval_max; + } $previous_data = $total; // Compressed data - } else { + } + else { if ($uncompressed_module || ($timestamp > time ())) { - $chart[$timestamp]['sum'] = 0; - $chart[$timestamp]['min'] = 0; - $chart[$timestamp]['max'] = 0; - } else { - $chart[$timestamp]['sum'] = $previous_data; - $chart[$timestamp]['min'] = $previous_data; - $chart[$timestamp]['max'] = $previous_data; + if ($avg_only) { + $chart[$timestamp]['sum'] = 0; + } + else { + $chart[$timestamp]['sum'] = 0; + $chart[$timestamp]['min'] = 0; + $chart[$timestamp]['max'] = 0; + } + } + else { + if ($avg_only) { + $chart[$timestamp]['sum'] = $previous_data; + } + else { + $chart[$timestamp]['sum'] = $previous_data; + $chart[$timestamp]['min'] = $previous_data; + $chart[$timestamp]['max'] = $previous_data; + } } } @@ -238,12 +262,16 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, if($show_alerts) { $chart[$timestamp]['alert'] = $alert_value; } - $chart[$timestamp]['baseline'] = array_shift ($baseline_data); - if ($chart[$timestamp]['baseline'] == NULL) { - $chart[$timestamp]['baseline'] = 0; - } - $units = modules_get_unit($agent_module_id); - $chart[$timestamp]['unit'] = 0; + if ($baseline) { + $chart[$timestamp]['baseline'] = array_shift ($baseline_data); + if ($chart[$timestamp]['baseline'] == NULL) { + $chart[$timestamp]['baseline'] = 0; + } + } + + if (!empty($units)) { + $chart[$timestamp]['unit'] = 0; + } } // Return chart data and don't draw diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 4213ada1b2..d8a2bada0c 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -96,6 +96,15 @@ function getTermEle(ele) { } return ele; } + +function show_others() { + if (!$("#checkbox-avg_only").attr('checked')) { + $("#hidden-show_other").val(1); + } + else { + $("#hidden-show_other").val(0); + } +} //--> @@ -111,7 +120,11 @@ if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) { $period = get_parameter ( "period", 3600); $draw_alerts = get_parameter("draw_alerts", 0); -$avg_only = get_parameter ("avg_only", 0); +$avg_only = get_parameter ("avg_only", 1); +$show_other = (bool)get_parameter('show_other', false); +if ($show_other) { + $avg_only = 0; +} $period = get_parameter ("period", 86400); $id = get_parameter ("id", 0); $width = get_parameter ("width", 555); @@ -186,7 +199,8 @@ html_print_input_text ("refresh", $refresh, '', 5); echo '   '.__('Avg. Only'); -html_print_checkbox ("avg_only", 1, (bool) $avg_only); +html_print_checkbox ("avg_only", 1, (bool) $avg_only, false, false, 'show_others()'); +html_print_input_hidden('show_other', 0); echo ''.__('Begin date').'';