|
|
@ -12,17 +12,21 @@ my $output = undef; |
|
|
|
# you may want to be notified before it's reached, so you can |
|
|
|
# you may want to be notified before it's reached, so you can |
|
|
|
# set a margin which will be substracted from the real threshold |
|
|
|
# set a margin which will be substracted from the real threshold |
|
|
|
my $temp_margin = '20'; |
|
|
|
my $temp_margin = '20'; |
|
|
|
|
|
|
|
my $temp_hd_margin = '10'; |
|
|
|
my $pwr_margin = '200'; |
|
|
|
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 $temp_hd_hyst = '5'; |
|
|
|
my $pwr_hyst = '200'; |
|
|
|
my $pwr_hyst = '200'; |
|
|
|
|
|
|
|
|
|
|
|
GetOptions( |
|
|
|
GetOptions( |
|
|
|
"output=s" => \$output, |
|
|
|
"output=s" => \$output, |
|
|
|
"temp-margin=i" => \$temp_margin, |
|
|
|
"temp-margin=i" => \$temp_margin, |
|
|
|
"pwr-margin=i" => \$pwr_margin, |
|
|
|
"temp-hd-margin=i" => \$temp_hd_margin, |
|
|
|
"temp-hyst=i" => \$temp_hyst, |
|
|
|
"pwr-margin=i" => \$pwr_margin, |
|
|
|
|
|
|
|
"temp-hyst=i" => \$temp_hyst, |
|
|
|
|
|
|
|
"temp-hd-hyst=i" => \$temp_hd_hyst |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
sub usage(){ |
|
|
|
sub usage(){ |
|
|
@ -252,8 +256,8 @@ if (-x $smartctl){ |
|
|
|
my $sensor = { |
|
|
|
my $sensor = { |
|
|
|
description => "Temperature for disk No $i on sda", |
|
|
|
description => "Temperature for disk No $i on sda", |
|
|
|
type => 'temp', |
|
|
|
type => 'temp', |
|
|
|
threshold_high => $1-$temp_margin, |
|
|
|
threshold_high => $1-$temp_hd_margin, |
|
|
|
threshold_low => $1-$temp_margin-$temp_hyst, |
|
|
|
threshold_low => $1-$temp_hd_margin-$temp_hyst, |
|
|
|
unit => '°C', |
|
|
|
unit => '°C', |
|
|
|
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}'" |
|
|
|
}; |
|
|
|
}; |
|
|
|