Page 1 of 2

check_jvm

Posted: Tue Mar 05, 2013 7:25 pm
by yaanatech
Hi All,

Does anyone have experience with this monitoring script? I have been attempting to implement but am having a few issues.

check_jvm works from the Nagios server, but not through NRPE
wrote a wrapper script and still had the same issue

Works

Code: Select all

./check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:4114/jmxrmi -O fetchJobMbean:type=fetchJobWrapper -A NumberOfJobsInRamStore -K store
JMX OK NumberOfJobsInRamStore.store=1038
Doesn't work

Code: Select all

./check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:4114/jmxrmi -O org.hornetq:module=JMS,type=Queue -A MessageCount -K count -vvv
JMX CRITICAL org.hornetq:module=JMS,type=Queue connecting to org.hornetq:module=JMS,type=Queue by URL service:jmx:rmi:///jndi/rmi://glisp2-sdap1:4114/jmxrmijavax.management.InstanceNotFoundException: org.hornetq:module=JMS,type=Queue
Any suggestions for these 2 issues?

Re: check_jvm

Posted: Wed Mar 06, 2013 11:46 am
by scottwilkerson
Can you post the NRPE config from the remote machine for this and how you are calling it from XI

Re: check_jvm

Posted: Wed Mar 06, 2013 1:21 pm
by yaanatech
Here you go;

Code: Select all

command[check_jmxWrapper]=/usr/lib64/nagios/plugins/misc/check_jmxWrapper.sh

Code: Select all

#!/bin/bash

STATE_OK=0

/usr/lib64/nagios/plugins/misc/check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:4114/jmxrmi -O fetchJobMbean:type=fetchJobWrapper -A NumberOfJobsInRamStore -K store > /tmp/jmx.stats

jmxStats=`cat /tmp/jmx.stats`

echo $jmxStats

exit $STATE_OK
This works fine if I run it local on my destination host, or if I add it local to the Nagios server as a command that checks the remote host. As a NRPE command, no dice.

Re: check_jvm

Posted: Wed Mar 06, 2013 1:49 pm
by sreinhardt
Can you run this command via cli from the nagios machine through nrpe? Does the remote host get a /tmp/jmx.stats file created from an nrpe check? You may have to remove the file from running it previously.

Re: check_jvm

Posted: Wed Mar 06, 2013 5:13 pm
by yaanatech
sreinhardt wrote:Can you run this command via cli from the nagios machine through nrpe? Does the remote host get a /tmp/jmx.stats file created from an nrpe check? You may have to remove the file from running it previously.
Yeah I can run the command via check_nrpe and the jmx.stats is created, but contains no data. Locally on the server with java, the data is created and echo displays it correctly.

Re: check_jvm

Posted: Wed Mar 06, 2013 5:40 pm
by sreinhardt
Maybe we are misunderstanding eachother. I expect the tmp file to be created on the remote server not the local nagios machine. From there, that same nrpe command has to interpret and issue back results. What you might be better off doing, is making this a script on the remote java machine with the check script\file, and executing that through nrpe.

Re: check_jvm

Posted: Thu Mar 07, 2013 1:17 pm
by yaanatech
sreinhardt wrote:Maybe we are misunderstanding eachother. I expect the tmp file to be created on the remote server not the local nagios machine. From there, that same nrpe command has to interpret and issue back results. What you might be better off doing, is making this a script on the remote java machine with the check script\file, and executing that through nrpe.
Yes I am using NRPE to execute the script on the remote server and yes that remote server is creating the /tmp/jmx.stats - however that file contains no data. First I tried running check_jmx via NRPE, which did not work. Then I created a wrapper scripr to run via NRPE which would take the check_jmx output and echo that to a /tmp file. If I run the same scripts on the remote machine, everything works, when I use NRPE, again the /tmp/jmx.stats is created - but contains no data.

Re: check_jvm

Posted: Thu Mar 07, 2013 1:22 pm
by yaanatech
Also I have verified ownership/permissions to /tmp/jmx.stats - everything looks good.

Re: check_jvm

Posted: Thu Mar 07, 2013 2:12 pm
by sreinhardt
That last comment was my next thought as well. How about this, what user is nrpe running as, and when you execute it locally on the remote machine as that user how does it react?

Re: check_jvm

Posted: Thu Mar 07, 2013 2:12 pm
by abrist
I would assume this means that the following part of your script:

Code: Select all

/usr/lib64/nagios/plugins/misc/check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:4114/jmxrmi -O fetchJobMbean:type=fetchJobWrapper -A NumberOfJobsInRamStore -K store 
Is not returning data. You may want to check your logs for more clues to "why". Have you tried running the script locally on the remote system as user *nagios*?