1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-24 03:13:47 +01:00

Changes after multipath upgrade. Use multipath -ll and fix a regex counter for ok lines

This commit is contained in:
Admin - Eyþór Ívarsson 2017-03-23 11:43:02 +00:00
parent 7dc3b57582
commit 8f89f773e3

View File

@ -48,9 +48,9 @@ print_help() {
echo "Add this to your sudoers file by running visudo to add access:" echo "Add this to your sudoers file by running visudo to add access:"
if [ -r /proc/modules ]; then if [ -r /proc/modules ]; then
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l" echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll"
else else
echo "Cmnd_Alias MULTIPATH=$MULTIPATH -l, $SUDO" echo "Cmnd_Alias MULTIPATH=$MULTIPATH -ll, $SUDO"
fi fi
echo "nagios ALL= NOPASSWD: MULTIPATH" echo "nagios ALL= NOPASSWD: MULTIPATH"
echo "The user nagios may very well be nobody or someone else depending on your configuration" 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
fi fi
OUTPUT=$($MULTIPATH -l 2>/dev/null) OUTPUT=$($MULTIPATH -ll 2>/dev/null)
if [ $? != 0 ]; then if [ $? != 0 ]; then
# Failed. grab more info why # Failed. grab more info why
if [ $(id -un) != "root" ] && [ `$SUDO -l | grep -c multipath` -eq 0 ]; then if [ $(id -un) != "root" ] && [ `$SUDO -l | grep -c multipath` -eq 0 ]; then
@ -112,7 +112,7 @@ if [ $? != 0 ]; then
exit $STATE_UNKNOWN exit $STATE_UNKNOWN
fi fi
echo "MULTIPATH: $(MULTIPATH -l 2>&1)" echo "MULTIPATH: $(MULTIPATH -ll 2>&1)"
exit $STATE_UNKNOWN exit $STATE_UNKNOWN
fi fi
@ -137,6 +137,7 @@ if [ "$NUMPATHS" ]; then
/^ \\/ {targets++; next} # count targets (lenny) /^ \\/ {targets++; next} # count targets (lenny)
/[0-9]+:[0-9]+:[0-9]+:[0-9]+/ { /[0-9]+:[0-9]+:[0-9]+:[0-9]+/ {
if (/active undef running/) { targets++ } # count targets (squeeze) if (/active undef running/) { targets++ } # count targets (squeeze)
if (/active ready running/) { targets++ } # count targets (RHEL6)
next next
} }
{ {