packages: nagios-plugin-check_raid/check_raid - fix megaraid check

glen glen at pld-linux.org
Thu Oct 8 16:04:51 CEST 2009


Author: glen                         Date: Thu Oct  8 14:04:51 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix megaraid check

---- Files affected:
packages/nagios-plugin-check_raid:
   check_raid (1.53 -> 1.54) 

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.53 packages/nagios-plugin-check_raid/check_raid:1.54
--- packages/nagios-plugin-check_raid/check_raid:1.53	Thu Oct  8 15:57:18 2009
+++ packages/nagios-plugin-check_raid/check_raid	Thu Oct  8 16:04:46 2009
@@ -103,7 +103,7 @@
 # MegaIDE RAID controller
 sub check_megaide {
 	my $fh;
-	foreach my $f (glob('/proc/megaide/*/status')) {
+	foreach my $f (</proc/megaide/*/status>) {
 		if (-r $f) {
 			open $fh, '<', $f or next;
 		} else {
@@ -353,7 +353,7 @@
 # MegaRAID
 sub check_megaraid {
 	my $fh;
-	foreach my $f (glob('/proc/megaraid/*/raiddrives*')) {
+	foreach my $f (</proc/megaraid/*/raiddrives*>) {
 		if (-r $f) {
 			open $fh, '<', $f or next;
 		} else {
@@ -362,15 +362,16 @@
 			open($fh , '-|', @CMD) or next;
 		}
 		while (<$fh>) {
-			next if (my($n, $s) = /logical drive\s*:\s*(\d+).*, state\s*:\s*(\S+)/i);
-			next unless valid($n);
-			if ($s ne 'optimal') {
-				$status = $ERRORS{CRITICAL};
-				$message .= "Megaraid:$n:$s ";
-			} else {
-				$message .= "Megaraid:$n:$s ";
+			if (my($n, $s) = /logical drive\s*:\s*(\d+).*, state\s*:\s*(\S+)/i) {
+				next unless valid($n);
+				if ($s ne 'optimal') {
+					$status = $ERRORS{CRITICAL};
+					$message .= "Megaraid:$n:$s ";
+				} else {
+					$message .= "Megaraid:$n:$s ";
+				}
+				last;
 			}
-			last;
 		}
 		close $fh;
 	}
@@ -817,7 +818,7 @@
 	push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $megarc -dispCfg -a* -nolog\n") if $megarc;
 	push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cmdtool2 -AdpAllInfo -aALL -nolog\n") if $cmdtool2;
 	push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cmdtool2 -CfgDsply -a* -nolog\n") if $cmdtool2;
-	foreach my $mr (glob('/proc/mega*/*/raiddrives*')) {
+	foreach my $mr (</proc/mega*/*/raiddrives*>) {
 		push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cat $mr\n") if -d $mr;
 	}
 
================================================================

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



More information about the pld-cvs-commit mailing list