version 1.21, 2006/12/05 16:26:27 |
version 1.22, 2007/01/06 03:16:41 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver: check_hw_sensors,v 1.20 2006/12/05 00:17:47 andrew Exp $ |
# $RedRiver: check_hw_sensors,v 1.21 2006/12/05 16:26:27 andrew Exp $ |
######################################################################## |
######################################################################## |
# check_hw_sensors *** A nagios check for OpenBSD hw.sensors |
# check_hw_sensors *** A nagios check for OpenBSD hw.sensors |
# |
# |
|
|
#while (<>) { |
#while (<>) { |
chomp; |
chomp; |
my ($id, $output) = split /=/; |
my ($id, $output) = split /=/; |
|
my @s = split /\./, $id; |
my @o = split /,\s*/, $output; |
my @o = split /,\s*/, $output; |
|
|
my ($type, $source, $descr, $data, $status); |
my ($type, $source, $descr, $data, $status); |
|
|
$source = $o[0]; |
$source = $o[0]; |
$descr = $o[1]; |
$descr = $o[1]; |
|
|
if ($OSVer >= 4.0) { |
if (@s == 4) { # XXX This mebbe needs to end up $OSVer >= 4.1 |
|
$data = $o[0]; |
|
$descr =~ s/^\(|\)$//g; |
|
$status = $o[2]; |
|
($source, $type) = $id =~ /([^\.]+)\.([^\.]+)\d+$/; |
|
} elsif ($OSVer >= 4.0) { |
$data = $o[2]; |
$data = $o[2]; |
$status = $o[3]; |
$status = $o[3]; |
foreach my $t (@Type_Map) { |
foreach my $t (@Type_Map) { |
|
|
foreach my $code ('warn', 'crit') { |
foreach my $code ('warn', 'crit') { |
if ( |
if ( |
$sensor->{'type'} eq 'fanrpm' || |
$sensor->{'type'} eq 'fanrpm' || |
|
$sensor->{'type'} eq 'volt' || |
$sensor->{'type'} eq 'volts_dc' || |
$sensor->{'type'} eq 'volts_dc' || |
$sensor->{'type'} eq 'amps' || |
$sensor->{'type'} eq 'amps' || |
$sensor->{'type'} eq 'watthour' || |
$sensor->{'type'} eq 'watthour' || |