check_jvm

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

check_jvm

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_jvm

Post by scottwilkerson »

Can you post the NRPE config from the remote machine for this and how you are calling it from XI
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Re: check_jvm

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_jvm

Post 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.
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.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Re: check_jvm

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_jvm

Post 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.
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.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Re: check_jvm

Post 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.
yaanatech
Posts: 74
Joined: Thu Mar 29, 2012 1:23 pm

Re: check_jvm

Post by yaanatech »

Also I have verified ownership/permissions to /tmp/jmx.stats - everything looks good.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_jvm

Post 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?
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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_jvm

Post 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*?
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.
Locked