[Nagiosplug-checkins] nagiosplug/contrib check_linux_raid.pl,1.2,1.3

Matthew Kent mattkent at users.sourceforge.net
Sun Nov 28 20:50:01 CET 2004


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

Modified Files:
	check_linux_raid.pl 
Log Message:
Better error checking (820806)


Index: check_linux_raid.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/contrib/check_linux_raid.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_linux_raid.pl	20 Nov 2004 22:43:51 -0000	1.2
+++ check_linux_raid.pl	29 Nov 2004 04:49:10 -0000	1.3
@@ -26,6 +26,12 @@
 
 my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
 
+# die with an error if we're not on Linux
+if ($^O ne 'linux') {
+    print "This plugin only applicable on Linux.\n";
+    exit $ERRORS{'UNKNOWN'};
+}
+
 open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat";
 my $found = 0;
 my $status = "";
@@ -43,7 +49,7 @@
 	    last;
         }
     } else {
-        if (/$ARGV[0]/) {
+        if (/^$ARGV[0]\s*:/) {
             $found = 1;
             if (/active/) {
                 $active = 1;





More information about the Commits mailing list