SOURCES: nagios-plugin-check_multipath.sh - count paths check

glen glen at pld-linux.org
Thu Oct 25 00:35:37 CEST 2007


Author: glen                         Date: Wed Oct 24 22:35:37 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- count paths check

---- Files affected:
SOURCES:
   nagios-plugin-check_multipath.sh (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: SOURCES/nagios-plugin-check_multipath.sh
diff -u SOURCES/nagios-plugin-check_multipath.sh:1.7 SOURCES/nagios-plugin-check_multipath.sh:1.8
--- SOURCES/nagios-plugin-check_multipath.sh:1.7	Thu Oct 25 00:15:14 2007
+++ SOURCES/nagios-plugin-check_multipath.sh	Thu Oct 25 00:35:31 2007
@@ -117,8 +117,27 @@
 fi
 
 if [ "$NUMPATHS" ]; then
-	echo "MULTIPATH: NUMPATHS check not implemented"
-	exit $STATE_UNKNOWN
+	echo "$OUTPUT" | awk -vnumpaths=$NUMPATHS -vrc=0 -vlun= -vtargets=0 '
+	/^\[/{next} # skip flags
+   	/^\\/{targets++; next} # count targets
+	/^ \\/{next} # skip devinfo
+	{
+		# The LUN line
+		# process if this is not first LUN
+		if (lun && numpaths != targets) {
+			printf("CRITICAL: %d of %d paths available for LUN %s\n", numpaths, targets, lun);
+			rc = 1
+		}
+
+		# reset counter
+		targets=0
+		lun=$0
+	}
+	END { exit rc }
+	'
+	if [ $? -gt 0 ]; then
+		exit $STATE_CRITICAL
+	fi
 fi
 
 echo "MULTIPATH: OK - No failed paths"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/nagios-plugin-check_multipath.sh?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list