Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
First of all great script. I’m running RedHat 7.5 and had a problem with the $TRUST_EXIT_CODE. The check was allways ok, even when the checked service was not running. Because of line 255:
[ $TRUST_EXIT_CODE -eq 1 ] && [ $EXIT_CODE -eq 0 ] && echo “Trust $STATUS_MSG” && exit $OK
I changed in the if section for $OS == linux line 85 from $TRUST_EXIT_CODE=1 to $TRUST_EXIT_CODE=0 and script is working as expected.
determine_service_tool() { if [[ $OS == linux ]]; then if command -v systemctl >/dev/null 2>&1; then SERVICETOOL=”systemctl status $SERVICE | grep -i Active” LISTTOOL=”systemctl” if [ $USERNAME ]; then SERVICETOOL=”sudo -u $USERNAME systemctl status $SERVICE” LISTTOOL=”sudo -u $USERNAME systemctl” fi TRUST_EXIT_CODE=0 # changed from 1 to 0
Maybe this will help some one or you can fix it permenantly. Kind regards