From 5d8c7a1c2b2e4b057109da8021fbad4dc2301682 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Tue, 17 Nov 2015 15:02:53 +0100 Subject: [PATCH] Fixed gauges in custom and dashboard. Tiquet: #2967 (cherry picked from commit 0ba80f3d3f3afb2f0a613d6f5dadbcf054f825f2) --- pandora_console/include/functions_graph.php | 7 +++++-- pandora_console/include/graphs/pandora.d3.js | 13 +++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 1ec38a1d04..6dc0f1cc18 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1481,8 +1481,11 @@ function graphic_combined_module ($module_list, $weight_list, $period, $temp[$module]['min'] = 0; $temp[$module]['max'] = 100; }else{ - $min = reporting_get_agentmodule_data_min($module,$period,$date); - $max = reporting_get_agentmodule_data_max($module,$period,$date); + $min = $temp[$module]['min']; + if ($temp[$module]['max'] == 0) + $max = reporting_get_agentmodule_data_max($module,$period,$date); + else + $max = $temp[$module]['max']; $temp[$module]['min'] = ($min)== 0 ? 0 : $min; $temp[$module]['max'] = ($max)== 0 ? 100 : $max; } diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index f95d6d409c..5ccf3271c2 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -872,13 +872,14 @@ function createGauge(name, etiqueta, value, min, max, min_warning,max_warning,mi //var range = config.max - config.min; var range = config.max - config.min; - if ( min_warning > 0 ) { - config.yellowZones = [{ from: min_warning, to: max_warning }]; + if (value >= min_warning){ + if ( min_warning > 0 ) { + config.yellowZones = [{ from: min_warning, to: max_warning }]; + } + if ( min_critical > 0 ) { + config.redZones = [{ from: min_critical, to: max_critical }]; + } } - if ( min_critical > 0 ) { - config.redZones = [{ from: min_critical, to: max_critical }]; - } - gauges = new Gauge(name, config); gauges.render(); gauges.redraw(value);