[Nagiosplug-checkins] nagiosplug/contrib check_linux_raid.pl, 1.4, 1.5

M. Sean Finney seanius at users.sourceforge.net
Wed Jun 7 16:28:35 CEST 2006


Update of /cvsroot/nagiosplug/nagiosplug/contrib
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6694

Modified Files:
	check_linux_raid.pl 
Log Message:
some gratuitous whitespace changes, and a fix to the "recovery =" detection
logic in check_linux_raid.pl


Index: check_linux_raid.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/contrib/check_linux_raid.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- check_linux_raid.pl	1 Jun 2006 22:30:51 -0000	1.4
+++ check_linux_raid.pl	7 Jun 2006 14:28:33 -0000	1.5
@@ -20,7 +20,7 @@
 #
 # Usage:   check_raid [raid-name]
 # Example: check_raid md0
-#          WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
+#	  WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
 
 use strict;
 use lib utils.pm;
@@ -61,19 +61,17 @@
 		if (defined $device) {
 			if (/(\[[_U]+\])/) {
 				$status{$device} = $1;
-				$device = undef;
 			} elsif (/recovery = (.*?)\s/) {  
 				$recovery{$device} = $1;
 				($finish{$device}) = /finish=(.*?min)/;
-				$device = undef;
+			} elsif (/^\s*$/) {
+				$device=undef;
 			}
-		} else {
-			if (/^($nextdev)\s*:/) {
-				$device=$1;
-				$devices{$device}=$device;
-				if (/active/) {
-					$active{$device} = 1;
-				}
+		} elsif (/^($nextdev)\s*:/) {
+			$device=$1;
+			$devices{$device}=$device;
+			if (/active/) {
+				$active{$device} = 1;
 			}
 		}
 	}
@@ -82,7 +80,7 @@
 
 foreach my $k (sort keys %devices){
 	if ($status{$k} =~ /_/) {
-		if ($recovery{$k}) {
+		if (defined $recovery{$k}) {
 			$msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
 				$devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
 			$code = max_state($code, "WARNING");





More information about the Commits mailing list