Fix pwr thresholds order

tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 10 years ago
parent 113f72fb3a
commit cf8585f524
  1. 8
      zabbix_scripts/util_generate_sensors_ini

@ -16,6 +16,7 @@ my $pwr_margin = '200';
#This value will be substracted from the higher threshold to define the low one #This value will be substracted from the higher threshold to define the low one
#so you can have hysteresis to prevent flip-flop #so you can have hysteresis to prevent flip-flop
my $temp_hyst = '10'; my $temp_hyst = '10';
my $pwr_hyst = '200';
GetOptions( GetOptions(
"output=s" => \$output, "output=s" => \$output,
@ -46,7 +47,6 @@ my $def_fan_thres_high = '1000';
my $def_fan_thres_low = '700'; my $def_fan_thres_low = '700';
my $def_pwr_thres_high = '1000'; my $def_pwr_thres_high = '1000';
my $def_pwr_thres_low = '800';
my $cfg = new Config::Simple(syntax => 'ini'); my $cfg = new Config::Simple(syntax => 'ini');
@ -174,14 +174,14 @@ if (-x $ipmitool){
} }
} }
elsif ($d =~ m/^\s*Upper\scritical\s*:\s*(\d+(\.\d+))/){ elsif ($d =~ m/^\s*Upper\scritical\s*:\s*(\d+(\.\d+))/){
$sensor->{threshold_low} = $1-$pwr_margin; $sensor->{threshold_high} = $1-$pwr_margin;
} }
elsif ($d =~ m/^\s*Upper\snon\-critical\s*:\s*(\d+(\.\d+))/){ elsif ($d =~ m/^\s*Upper\snon\-critical\s*:\s*(\d+(\.\d+))/){
$sensor->{threshold_high} = $1-$pwr_margin; $sensor->{threshold_low} = $1-$pwr_margin;
} }
} }
$sensor->{threshold_high} ||= $def_pwr_thres_high; $sensor->{threshold_high} ||= $def_pwr_thres_high;
$sensor->{threshold_low} ||= $def_pwr_thres_high-$temp_hyst; $sensor->{threshold_low} ||= $def_pwr_thres_high-$pwr_hyst;
$sensor->{threshold_high} =~ s/\.0+$//; $sensor->{threshold_high} =~ s/\.0+$//;
$sensor->{threshold_low} =~ s/\.0+$//; $sensor->{threshold_low} =~ s/\.0+$//;
$sensor->{description} = $name; $sensor->{description} = $name;

Loading…
Cancel
Save