version 1.7, 2009/11/09 18:00:09 |
version 1.8, 2009/11/09 18:11:33 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver: check_bioctl,v 1.6 2009/11/09 17:58:29 andrew Exp $ |
# $RedRiver: check_bioctl,v 1.7 2009/11/09 18:00:09 andrew Exp $ |
######################################################################## |
######################################################################## |
# check_bioctl *** A nagios check for OpenBSD bioctl |
# check_bioctl *** A nagios check for OpenBSD bioctl |
# |
# |
# 2006.07.26 #*#*# andrew fresh <andrew@mad-techies.org> |
# 2006.07.26 #*#*# andrew fresh <andrew@mad-techies.org> |
######################################################################## |
######################################################################## |
# TODO: |
|
# Really need real documentation. |
|
######################################################################## |
|
use strict; |
use strict; |
use warnings; |
use warnings; |
|
|
|
|
|
|
my %VOLUMES; |
my %VOLUMES; |
foreach my $device (@devices) { |
foreach my $device (@devices) { |
open my $bioctl, "-|", $BIOCTL, $device or die "Couldn't open bioctl: $!"; |
open my $bioctl, '-|', $BIOCTL, $device or die "Couldn't open bioctl: $!"; |
my $volume_id; |
my $volume_id; |
|
|
while (<$bioctl>) { |
while (<$bioctl>) { |
|
|
} |
} |
|
|
my $have_results = 0; |
my $have_results = 0; |
|
$state = 'OK'; |
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++; |
$have_results++; |
|
|
|
|
if (NAGIOS_OUTPUT) { |
if (NAGIOS_OUTPUT) { |
print "$error (" . scalar( @{ $states{$error} } ) . ")"; |
print "$error (" . scalar( @{ $states{$error} } ) . ")"; |
unless ( $error eq 'OK' ) { |
if ( $error ne 'OK' ) { |
print '<br>'; |
print '<br>'; |
print map {" - $_<br>"} @{ $states{$error} }; |
print map {" - $_<br>"} @{ $states{$error} }; |
} |
} |