--- check_raid-2004-09-15.pl Wed Sep 15 10:55:49 2004 +++ check_raid-2005-05-13.pl Fri May 13 09:18:31 2005 @@ -17,6 +17,7 @@ # Copyright (C) 2004 Craig Kelley # Copyright (C) 2001 Kent Zeibell and Matt Domsch # Copyright (C) 2004 Jonathan Delgado +# Copyright (C) 2005 Marc Fournier (battry and log fixes) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -49,6 +50,7 @@ $0 [-v] [-a container] [-l path to syslog] <-w num drives> <-c num drives> -a containter (default=afa0) + -b ignore battery state (for systems with no battery backup) -c # of drives at or below triggers a critical failure -l path to syslog where AAC errors would be reported (default=/var/log/messages) -v verbose output -- for running manually only, not from Nagios/nrpe @@ -61,7 +63,7 @@ 'UNKNOWN' => 3 ); my %opts; -unless (getopts('a:c:l:vw:', \%opts)) { +unless (getopts('a:bc:l:vw:', \%opts)) { print $USAGE; critical(); } @@ -233,7 +235,7 @@ # AAC:Drive 0:2:0 offline on container 0: # AAC:RAID5 Failover Container 0 No Failover Assigned - my $err_count = `egrep "(AAC|aacraid):" $syslog | grep -vi batter | wc -l`; + my $err_count = `egrep "(AAC|aacraid):" $syslog | egrep -vi 'batter|falsely claims to have parameter commit' | wc -l`; $err_count =~ s/\D//g; if ($err_count > 0) { print "detected $err_count aacraid errors in $syslog\n"; @@ -246,19 +248,21 @@ } # make sure battery is in 'OK' state -if ($battery =~ /ok/i) { - $status_description .= "bat OK "; -} -else { - if (($battery =~ /Reconditioning/i ) || - ($battery =~ /Low/i ) || - ($battery =~ m/Charging/i )) { - print "Battery state '$battery'"; - warning(); +unless (defined $opts{b}) { + if ($battery =~ /ok/i) { + $status_description .= "bat OK "; } else { - print "Battery state '$battery'"; - critical(); + if (($battery =~ /Reconditioning/i ) || + ($battery =~ /Low/i ) || + ($battery =~ m/Charging/i )) { + print "Battery state '$battery'"; + warning(); + } + else { + print "Battery state '$battery'"; + critical(); + } } }