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
;;
esac
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?