1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 02:13:44 +01:00

Merge pull request #31 from eythori-sensa/fix_rhel6_multipatch_check

Fix rhel6 multipath check
This commit is contained in:
Garðar Þorsteinsson 2017-03-24 15:34:04 +00:00 committed by GitHub
commit 51c659990b

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
} }
{ {