No Performance Counter Displauyed in Status Information
Posted: Tue Feb 21, 2012 11:21 am
I created a shell script plugin and defined my own performance counter.But the counter is not displayed in the Nagios Status Information.
The plugin just read one counter from my Oracle database. I run the command in terminal and it works.
Please see the command definition:
There should be a counter after JMS Message Queue:CCS: check_jms_queue
OK 02-21-2012 11:17:17 4d 1h 35m 22s 1/3 OK: JMS Message Queue: QueueNumber
The plugin just read one counter from my Oracle database. I run the command in terminal and it works.
Please see the command definition:
Code: Select all
#! /bin/sh
#For queue messages the bigger, the worse
#{1} Critical level
#{2} Warning level
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
if test -x /usr/bin/printf; then
ECHO=/usr/bin/printf
else
ECHO=echo
fi
if [ ${1} -lt ${2} ] ; then
echo "UNKNOWN - Warning level is bigger then Crit"
exit $STATE_UNKNOWN
fi
result=`sqlplus -s statjms/statjms_D3@ORCA << EOF
set pagesize 0
set numf '9999999'
select count(1) FROM JMS_MESSAGES;
EOF`
if [ -n "`echo $result | grep ORA-`" ] ; then
error=` echo "$result" | grep "ORA-" | head -1`
echo "CRITICAL - $error"
exit $STATE_CRITICAL
fi
queuenum=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
queuenumx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'`
if [ $queuenum -ge ${1} ] ; then
echo "${1} CRITICAL - JMS Message Queue:" $queuenumx "Exceed Critical QueueNumber|QueueNumber=$queuenumx"
exit $STATE_CRITICAL
fi
if [ $queuenum -le ${1} -a $queuenum -ge ${2} ] ; then
echo "${2} WARNING - JMS Message Queue:" $queuenumx "Exceed Warning QueueNumber|QueueNumber=$queuenumx"
exit $STATE_WARNING
fi
echo "OK: JMS Message Queue: $queuenumx QueueNumber|QueueNumber=$queuenumx"
exit $STATE_OK
;;