I've gone through all of the suggestions from the dozens of posts I have seen here, but I'm still not able to get this to work.
The commands all run individually and the script runs as well, locally.
I added the nrpe user to the wheel and docker groups and set the wheel group in visudo to run anything without a password.
I modified /etc/passwd temporarily to allow the nrpe user to login with a shell. The script runs with or without sudo.
This part passes successfully:
Code: Select all
/bin/docker > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "UNKNOWN - Missing docker binary"
exit 3
fi
Code: Select all
/bin/docker stack ls | grep $STACK
if [ $? -eq 1 ]; then
echo "UNKNOWN - $STACK does not exist. $(/usr/bin/sudo /bin/docker stack ls) \n $(whoami)"
exit 3
fi
Any idea what permission I'm missing or is it something else?UNKNOWN - ValidService does not exist. \n nrpe.