From 5553e4a45fbda494a0c32b05e2a1a6ec70d36279 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 1 Jul 2013 15:41:40 +0000 Subject: [PATCH] 2013-07-01 Sergio Martin * include/functions_graph.php operation/agentes/stat_win.php: Fix string type graph colors and data. Fix the "Avg only" option because is forced to "true". Bug: 2284 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8443 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++ pandora_console/include/functions_graph.php | 50 +++++++++++++------ .../operation/agentes/stat_win.php | 2 +- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 122d2d8369..f5229a07e5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-07-01 Sergio Martin + + * include/functions_graph.php + operation/agentes/stat_win.php: Fix string type graph colors + and data. Fix the "Avg only" option because is forced to "true". + Bug: 2284 + 2013-07-01 Miguel de Dios * godmode/menu.php, include/functions_menu.php: fixed the entry diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0d9b35742d..746c30637f 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2461,10 +2461,9 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho } // Prints an error image -function fs_error_image () { +function fs_error_image ($width = 300, $height = 110) { global $config; - - return html_print_image("images/image_problem.png", true, array("border" => '0')); + return graph_nodata_image($width, $height, 'area'); } function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, @@ -3231,7 +3230,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, // Check available data if (count ($data) < $min_necessary) { if (!$graphic_type) { - return fs_error_image (); + return fs_error_image ($width, $height); } graphic_error (); } @@ -3307,9 +3306,17 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, // Data in the interval //The order in chart array is very important!!!! - $chart[$timestamp]['event'] = $event_value; - $chart[$timestamp]['alert'] = $alert_value; - $chart[$timestamp]['max'] = 0; + if ($show_events) { + $chart[$timestamp]['event'] = $event_value; + } + + if ($show_alerts) { + $chart[$timestamp]['alert'] = $alert_value; + } + + if(!$avg_only) { + $chart[$timestamp]['max'] = 0; + } if ($count > 0) { $chart[$timestamp]['sum'] = $count; @@ -3320,7 +3327,9 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $chart[$timestamp]['sum'] = $previous_data; } - $chart[$timestamp]['min'] = 0; + if(!$avg_only) { + $chart[$timestamp]['min'] = 0; + } } $graph_stats = get_statwin_graph_statistics($chart); @@ -3346,15 +3355,21 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $color = array(); if ($show_events) { - $color['event'.$series_suffix] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); + $color['event'] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50); } if ($show_alerts) { - $color['alert'.$series_suffix] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); + $color['alert'] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50); } - $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); + if(!$avg_only) { + $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); + } $color['sum'] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50); - $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); + + if(!$avg_only) { + $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); + } + //$color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); ///////////////////////////////////////////////////////////////////////////////////////// @@ -3373,10 +3388,15 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $legend['alert'] = __('Alerts'); } - $legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit; - $legend['sum'] = __('Data').': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit; - $legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit; + if(!$avg_only) { + $legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit; + } + $legend['sum'] = __('Data').': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit; + + if(!$avg_only) { + $legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit; + } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => ui_get_full_url("/images/logo_vertical_water.png")); diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 24fb631bcd..0afdbdfa8a 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -246,7 +246,7 @@ $label = base64_decode(get_parameter('label', '')); $table->data[] = $data; $table->rowclass[] = ''; - if ($graph_type != "boolean") { + if ($graph_type != "boolean" && $graph_type != "string") { $data = array(); $data[0] = __('Avg. Only'); $data[1] = html_print_checkbox ("avg_only", 1, (bool) $avg_only, true, false, 'show_others()');