Command return OK when check but Unkonwn on nagios
Posted: Mon Nov 11, 2013 4:00 am
Hey ,
i created a script that check if some process is running .
When i ran this command on /usr/local/nagios/libexec
the result is : " OK - 1 proc found . "
i created command like this :
and on nagios UI i get this warning - Status Information: UNKNOWN - proc found .
Some can help me ?
Thanks !!!
i created a script that check if some process is running .
Code: Select all
#!/bin/bash
# Nagios return codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
while getopts H:u:p:L: OPT
do
case $OPT in
"H" ) FLAGH="TRUE" ; HOST="$OPTARG" ;;
"p" ) FLAGu="TRUE" ; PEM="$OPTARG" ;;
* ) echo "Usage: $CMDNAME [-H HOST] [-pem /pem/file/location.pem ]. Example: -H 10.0.3.101 -pem /root/x.pem" 1>&2
exit $STATE_UNKNOWN ;;
esac
done
# Commands
RESULT=`ssh -i $PEM $HOST 'ps -ef | grep logstash | grep -v grep | wc -l'`
case $RESULT in
[1-2]*)
echo "OK - $RESULT proc found ."
exit $STATE_OK
;;
[0]*)
echo "CRITICAL - $RESULT proc found ."
exit $STATE_CRITICAL
;;
*)
echo "UNKNOWN - $RESULT proc found ."
exit $STATE_UNKNOWN
;;
esacWhen i ran this command on /usr/local/nagios/libexec
Code: Select all
./check_logstash.sh -H openx-dist1d -p /root/x.pemi created command like this :
Code: Select all
define command{
command_name check_logstash_virginia
command_line /usr/local/nagios/libexec/check_logstash.sh -H $HOSTADDRESS$ -p /root/x.pem
}Some can help me ?
Thanks !!!