packages: nagios-plugin-check_raid/check_raid - without /bin/sh check_mdsta...

glen glen at pld-linux.org
Wed Sep 9 18:14:33 CEST 2009


Author: glen                         Date: Wed Sep  9 16:14:33 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- without /bin/sh check_mdstat (checked)

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.11 packages/nagios-plugin-check_raid/check_raid:1.12
--- packages/nagios-plugin-check_raid/check_raid:1.11	Wed Sep  9 18:09:17 2009
+++ packages/nagios-plugin-check_raid/check_raid	Wed Sep  9 18:14:28 2009
@@ -114,17 +114,15 @@
 	}
 }
 sub check_mdstat {
-	my($l);
-	my($s,$n,$f);
+	my($n,$f);
 
-	open MDSTAT,"</proc/mdstat" or return;
-	while( $l = <MDSTAT> ) {
-		if( $l =~ /^(\S+)\s+:/ ) { $n = $1; $f = ''; next; }
-		if( $l =~ /(\S+)\[\d+\]\(F\)/ ) { $f = $1; next; }
-		if( $l =~ /\s*.*\[([U_]+)\]/ ) {
-			$s = $1;
-			next if(!valid($n));
-			if($s =~ /_/ ) {
+	open my $fh, '<', '/proc/mdstat' or return;
+	while (<$fh>) {
+		if (/^(\S+)\s+:/ ) { $n = $1; $f = ''; next; }
+		if (/(\S+)\[\d+\]\(F\)/ ) { $f = $1; next; }
+		if (my($s) = /\s*.*\[([U_]+)\]/ ) {
+			next unless valid($n);
+			if ($s =~ /_/) {
 				$status = $ERRORS{CRITICAL};
 				$message .= "md:$n:$f:$s ";
 			} else {
@@ -132,7 +130,7 @@
 			}
 		}
 	}
-	close MDSTAT;
+	close $fh;
 }
 sub check_lsraid {
 	my($l);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list