Random Project

Recommendation for Enhancement on ‘check_jmx’ shell script

The current check_jmx shell script won’t return information to the performance gathering subsystem in Nagios. Add-ons like PNP4nagios aren’t able to pick up the returned values without the proper output.

I offer this little hack…

RDIR=`dirname $0`
OUTPUT=`java -cp $RDIR/jmxquery.jar org.nagios.JMXQuery $@`
EXIT_STATUS=$?
STATUS=`echo $OUTPUT`
VALUE=`echo $OUTPUT | awk ‘{print $NF}’`
echo “$STATUS | $VALUE”

exit $EXIT_STATUS