From 8f89f773e36e32ba9ea2b642f6722bf5e98208b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Admin=20-=20Ey=C3=BE=C3=B3r=20=C3=8Dvarsson?= Date: Thu, 23 Mar 2017 11:43:02 +0000 Subject: [PATCH] Changes after multipath upgrade. Use multipath -ll and fix a regex counter for ok lines --- check_multipath/check_multipath | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/check_multipath/check_multipath b/check_multipath/check_multipath index b42ff02..5e005bc 100755 --- a/check_multipath/check_multipath +++ b/check_multipath/check_multipath @@ -48,9 +48,9 @@ print_help() { echo "Add this to your sudoers file by running visudo to add access:" if [ -r /proc/modules ]; then - echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l" + echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll" else - echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l, $SUDO" + echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll, $SUDO" fi echo "nagios ALL= NOPASSWD: MULTIPATH" echo "The user nagios may very well be nobody or someone else depending on your configuration" @@ -98,7 +98,7 @@ if [ $(id -un) != "root" ]; then fi fi -OUTPUT=$($MULTIPATH -l 2>/dev/null) +OUTPUT=$($MULTIPATH -ll 2>/dev/null) if [ $? != 0 ]; then # Failed. grab more info why if [ $(id -un) != "root" ] && [ `$SUDO -l | grep -c multipath` -eq 0 ]; then @@ -112,7 +112,7 @@ if [ $? != 0 ]; then exit $STATE_UNKNOWN fi - echo "MULTIPATH: $(MULTIPATH -l 2>&1)" + echo "MULTIPATH: $(MULTIPATH -ll 2>&1)" exit $STATE_UNKNOWN fi @@ -137,6 +137,7 @@ if [ "$NUMPATHS" ]; then /^ \\/ {targets++; next} # count targets (lenny) /[0-9]+:[0-9]+:[0-9]+:[0-9]+/ { if (/active undef running/) { targets++ } # count targets (squeeze) + if (/active ready running/) { targets++ } # count targets (RHEL6) next } {