./check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:4114/jmxrmi -O fetchJobMbean:type=fetchJobWrapper -A NumberOfJobsInRamStore -K store
JMX OK NumberOfJobsInRamStore.store=1038
#!/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.
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
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.
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
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.
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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
/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*?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.