packages: nagios-plugin-check_raid/check_raid - without /bin/sh check_mpt (...

glen glen at pld-linux.org
Wed Sep 9 18:09:23 CEST 2009


Author: glen                         Date: Wed Sep  9 16:09:23 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- without /bin/sh check_mpt (checked)
- cosmetics

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

---- Diffs:

================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.10 packages/nagios-plugin-check_raid/check_raid:1.11
--- packages/nagios-plugin-check_raid/check_raid:1.10	Wed Sep  9 17:56:56 2009
+++ packages/nagios-plugin-check_raid/check_raid	Wed Sep  9 18:09:17 2009
@@ -259,11 +259,11 @@
 sub check_mpt {
 	my($dsk,$stat);
 
-	my $CMD = $mpt_status;
-	$CMD = "$sudo $CMD" if $> and $sudo;
+	my @CMD = $mpt_status;
+	unshift(@CMD, $sudo) if $> and $sudo;
 
-	open CMD,"$CMD |" or return;
-	while ( <CMD> ) {
+	open(my $fh , '-|', @CMD) or return;
+	while (<$fh>) {
 		next if(! /vol_id\s*(\d+).*state\s+(\S+),/ );
 		($dsk,$stat) = ($1,$2);
 		next if(!valid($dsk));
@@ -276,7 +276,7 @@
 			$status = $ERRORS{UNKNOWN} ;
 		}
 	}
-	close CMD;
+	close $fh;
 }
 
 sub check_megaraid {
@@ -368,11 +368,14 @@
 @ignore = @ARGV if(@ARGV);
 
 if ($opt_v) {
-	print "check_raid Revision: $VERSION\n" ;
+	print "check_raid Version $VERSION\n" ;
 	exit $ERRORS{'OK'};
 }
-if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
-if($opt_W) {
+if ($opt_h) {
+	print_help();
+	exit $ERRORS{'OK'};
+}
+if ($opt_W) {
 	$ERRORS{CRITICAL} = $ERRORS{WARNING};
 }
 
================================================================

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



More information about the pld-cvs-commit mailing list