Fixed gauges in custom and dashboard. Tiquet: #2967

(cherry picked from commit 0ba80f3d3f)
This commit is contained in:
m-lopez-f 2015-11-17 15:02:53 +01:00
parent e199a0a013
commit 5d8c7a1c2b
2 changed files with 12 additions and 8 deletions

View File

@ -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;
}

View File

@ -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);