Nagios fails to update status change on one service only
Posted: Sun Feb 02, 2014 3:29 am
Hey all. I've been using nagios for a little while for a home lab. I haven't had any issues until recently with a really baffling problem that I absolutely cannot figure out.
For some reason when I try to use this script with a check, Nagios fails to see the change in service. Actually, the script appears to make Nagios go completely sideways for some reason. The script is pretty simple.
I know the service config and everything is fine. If I change the script to just exit 0 or 2 and force the check, it works. The second I put that code back in, it won't see status changes anymore and start doing wonky things.
Actually just now I put the code above back in, ran the script, it had exit 2 because it isn't running. But when I forced the nagios check, it says it's exit 0 and everything is fine. Okie dokie. I'm missing something here. I used this script (modified for another process) and it's working fine. But even on another machine, the same script above does the same thing.
Can anyone point me in the right direction? Am I missing something obvious?
For some reason when I try to use this script with a check, Nagios fails to see the change in service. Actually, the script appears to make Nagios go completely sideways for some reason. The script is pretty simple.
Code: Select all
#/bin/bash
#dsmcad_check.sh
serverup=$(ps -ef | grep -m 1 dsmca[d] | awk ' {print $8}' | wc -l)
case $serverup in
"1") echo "DSMCAD is running"
exit 0
;;
"0") echo "CRIT: DSMCAD is not running"
exit 2
;;
*) echo "Derp?"
exit 3
;;
esacActually just now I put the code above back in, ran the script, it had exit 2 because it isn't running. But when I forced the nagios check, it says it's exit 0 and everything is fine. Okie dokie. I'm missing something here. I used this script (modified for another process) and it's working fine. But even on another machine, the same script above does the same thing.
Can anyone point me in the right direction? Am I missing something obvious?