version 1.3, 2006/07/27 21:34:02 |
version 1.6, 2009/11/09 17:58:29 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver: check_bioctl,v 1.2 2006/07/27 01:08:13 andrew Exp $ |
# $RedRiver: check_bioctl,v 1.5 2009/11/09 17:57:32 andrew Exp $ |
######################################################################## |
######################################################################## |
# check_bioctl *** A nagios check for OpenBSD bioctl |
# check_bioctl *** A nagios check for OpenBSD bioctl |
# |
# |
|
|
# This maps the status we get from bioctl to something nagios can use |
# This maps the status we get from bioctl to something nagios can use |
my %Status_Map = ( |
my %Status_Map = ( |
Online => 'OK', |
Online => 'OK', |
Offline => 'WARNING', |
Offline => 'CRITICAL', |
Degraded => 'CRITICAL', |
Degraded => 'CRITICAL', |
Failed => 'CRITICAL', |
Failed => 'CRITICAL', |
Building => 'WARNING', |
Building => 'WARNING', |
|
|
} |
} |
|
|
my $have_results = 0; |
my $have_results = 0; |
foreach my $error (sort { $ERRORS{$a} <=> $ERRORS{$b} } keys %ERRORS) { |
|
if (exists $states{$error}) { |
|
$have_results++; |
|
$state = $error; |
|
} |
|
} |
|
foreach my $error (sort { $ERRORS{$b} <=> $ERRORS{$a} } keys %ERRORS) { |
foreach my $error (sort { $ERRORS{$b} <=> $ERRORS{$a} } keys %ERRORS) { |
if (exists $states{$error}) { |
if (exists $states{$error}) { |
|
$have_results++; |
|
$state = $error if $ERRORS{$state} < $ERRORS{$error}; |
|
|
if (NAGIOS_OUTPUT) { |
if (NAGIOS_OUTPUT) { |
print "$error (" . scalar(@{ $states{ $error } }) . ")"; |
print "$error (" . scalar(@{ $states{ $error } }) . ")"; |
unless ($error eq 'OK') { |
unless ($error eq 'OK') { |