version 1.8, 2006/05/02 22:23:29 |
version 1.9, 2006/05/03 03:26:47 |
|
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# $RedRiver: check_hw_sensors,v 1.7 2006/05/02 20:03:53 andrew Exp $ |
# $RedRiver: check_hw_sensors,v 1.8 2006/05/02 21:23:29 andrew Exp $ |
######################################################################## |
######################################################################## |
# check_hw_sensors *** A nagios check for OpenBSD hw.sensors |
# check_hw_sensors *** A nagios check for OpenBSD hw.sensors |
# |
# |
|
|
if (NAGIOS_OUTPUT) { |
if (NAGIOS_OUTPUT) { |
print "$error (" . scalar(@{ $states{ $error } }) . ")"; |
print "$error (" . scalar(@{ $states{ $error } }) . ")"; |
unless ($error eq 'OK') { |
unless ($error eq 'OK') { |
print '<br />'; |
print '<br>'; |
print map { " - $_<br />" } @{ $states{ $error } }; |
print map { " - $_<br>" } @{ $states{ $error } }; |
} |
} |
} else { |
} else { |
print "$error (" . scalar(@{ $states{ $error } }) . "):\n"; |
print "$error (" . scalar(@{ $states{ $error } }) . "):\n"; |
|
|
$result = $errors{$code} |
$result = $errors{$code} |
if ($c <= $data); |
if ($c <= $data); |
} |
} |
} elsif (defined $check->{$code}) { |
} elsif (@{ $check->{$code} }) { |
my $matched = 0; |
my $matched = 0; |
foreach my $c (@{ $check->{$code} }) { |
foreach my $c (@{ $check->{$code} }) { |
$c =~ s/[^\d\.]//g; |
$c =~ s/[^\d\.]//g; |
|
|
$result = $errors{$code} |
$result = $errors{$code} |
if ($c <= $data); |
if ($c <= $data); |
} |
} |
} elsif (defined $check->{$code}) { |
} elsif (@{ $check->{$code} }) { |
|
|
my $matched = 0; |
my $matched = 0; |
foreach my $c (@{ $check->{$code} }) { |
foreach my $c (@{ $check->{$code} }) { |
|
|
$sensor->{'type'} eq 'drive' || |
$sensor->{'type'} eq 'drive' || |
$sensor->{'type'} eq 'indicator' |
$sensor->{'type'} eq 'indicator' |
) { |
) { |
if (defined $check->{$code}) { |
if (@{ $check->{$code} }) { |
my $matched = 0; |
my $matched = 0; |
foreach (@{ $check->{$code} }) { |
foreach (@{ $check->{$code} }) { |
if ($_ eq $sensor->{'data'}) { |
if ($_ eq $sensor->{'data'}) { |