Use separate default threshold for UPS

+ minor coding style updates and optimizations
tags/zabbix-agent-addons-0.2.20-1 0.2.3_el5
Daniel Berteaud 9 years ago
parent 3183e26efc
commit 1dbc287840
  1. 14
      zabbix_scripts/util_generate_sensors_ini

@ -21,11 +21,13 @@ my $pwr_margin = '200';
# 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 $temp_hd_hyst = '5'; my $temp_hd_hyst = '5';
my $temp_ups_hyst = '10'; my $temp_ups_hyst = '5';
my $pwr_hyst = '200'; my $pwr_hyst = '200';
# Default threshold if not detected # Default threshold if not detected
my $def_temp_thres_high = '50'; my $def_temp_thres_high = '50';
my $def_hd_thres_high = '50';
my $def_ups_thres_high = '40';
my $def_fan_thres_high = '1000'; 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';
@ -216,8 +218,8 @@ if ($smartctl && -x $smartctl){
if ($l =~ /Temperature_Celsius/){ if ($l =~ /Temperature_Celsius/){
$sensors->{$block} = { $sensors->{$block} = {
description => "$block temperature", description => "$block temperature",
threshold_low => $def_temp_thres_high-$temp_hd_hyst, threshold_low => $def_hd_thres_high-$temp_hd_hyst,
threshold_high => $def_temp_thres_high, threshold_high => $def_hd_thres_high,
type => 'temp', type => 'temp',
unit => '°C', unit => '°C',
cmd => "$smartctl -A /dev/$block | grep Temperature_Celsius | awk '{print \$10}'" cmd => "$smartctl -A /dev/$block | grep Temperature_Celsius | awk '{print \$10}'"
@ -244,6 +246,7 @@ if ($smartctl && -x $smartctl){
cmd => "$smartctl -A -d megaraid,$i /dev/sda | grep 'Current Drive Temperature' | awk '{print \$4}'" cmd => "$smartctl -A -d megaraid,$i /dev/sda | grep 'Current Drive Temperature' | awk '{print \$4}'"
}; };
print "Found a temperature sensor using smartctl (megaraid): sda-$i\n"; print "Found a temperature sensor using smartctl (megaraid): sda-$i\n";
last;
} }
} }
} }
@ -260,12 +263,13 @@ if ($upsc && -x $upsc){
$sensors->{'ups_' . lc $ups} = { $sensors->{'ups_' . lc $ups} = {
description => "ups temperature for $ups", description => "ups temperature for $ups",
type => 'temp', type => 'temp',
threshold_high => $def_temp_thres_high, threshold_high => $def_ups_thres_high,
threshold_low => $def_temp_thres_high-$temp_ups_hyst, threshold_low => $def_ups_thres_high-$temp_ups_hyst,
unit => '°C', unit => '°C',
cmd => "$upsc $ups ups.temperature" cmd => "$upsc $ups ups.temperature"
}; };
print "Found a temperature sensor for ups $ups\n"; print "Found a temperature sensor for ups $ups\n";
last;
} }
} }
} }

Loading…
Cancel
Save