Code

Fix Debian bug #574612: Return WARNING on rebuild
[nagiosplug.git] / contrib / check_linux_raid.pl
index 11bc3cdcacc9cd7c5629b63fa90bcbedc5b09863..d2e5b4632d4b2b5631f38e45605388a74886efc1 100644 (file)
@@ -23,7 +23,7 @@
 #        WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
 
 use strict;
-use lib utils.pm;
+use lib "/usr/local/nagios/libexec";
 use utils qw(%ERRORS);
 
 # die with an error if we're not on Linux
@@ -44,7 +44,7 @@ sub max_state($$){
 
 my $nextdev;
 if(defined $ARGV[0]) { $nextdev = shift; }
-else { $nextdev = "md[0-9]"; }
+else { $nextdev = "md[0-9]+"; }
 
 my $code = "UNKNOWN";
 my $msg = "";
@@ -64,6 +64,7 @@ while(defined $nextdev){
                        } elsif (/recovery = (.*?)\s/) {  
                                $recovery{$device} = $1;
                                ($finish{$device}) = /finish=(.*?min)/;
+                               $device=undef;
                        } elsif (/^\s*$/) {
                                $device=undef;
                        }