Page 1 of 1

Need help with CHECK_JMX value

Posted: Fri Sep 01, 2017 4:33 am
by wassimc
Hey everyone.

I'am trying to setup some JMX monitors, but can't get it to work. The check is working fine but the value is a long string and not just value. So my question is how do I search for a specific word and value in the long string?

check_jmx -a '-U service:jmx:rmi:///jndi/rmi://192.168.197.25:8099/jmxrmi -O "STEP Monitoring:name=connectionStatuses" -A ConnectionStatuses -onlyvalue'

JMX OK - ConnectionStatuses={DB.connection=1, HST.connection=1, HST.keepalive=0, net.10.220.4.31-connection=0, net.10.220.4.31-keepalive=228, net.10.220.4.32-connection=0, net.10.220.4.32-keepalive=2, net.10.220.4.33-connection=0, net.10.220.4.33-keepalive=29, net.10.220.4.34-connection=0, net.10.220.4.34-keepalive=29, net.10.220.4.35-connection=0, net.10.220.4.35-keepalive=4, net.10.220.4.36-connection=0, net.10.220.4.36-keepalive=206, eros.10.220.5.34-connection=0, eros.10.220.5.34-keepalive=5, eros.10.220.5.35-connection=0, eros.10.220.5.35-keepalive=1, eros.10.220.5.36-connection=0, eros.10.220.5.36-keepalive=0, eros.10.220.5.37-connection=0, eros.10.220.5.37-keepalive=0}

I want to setup a monitor that alerts me if eros.10.220.5.34-keepalive=5 is greater than 300, i have tried -vvvv -w xx -c xx but that did not work.

Thanks in advance

Re: Need help with CHECK_JMX value

Posted: Fri Sep 01, 2017 11:16 am
by mcapra
If you don't mind my asking, what sort of application/server are you trying to monitor via JMX?

Which check_jmx are you using? Is it the one from these docs:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

If so, you might try leveraging the -K argument to pull a specific key's value out from the result set. Try this and share the output if it fails:

Code: Select all

check_jmx -a '-U service:jmx:rmi:///jndi/rmi://192.168.197.25:8099/jmxrmi -O "STEP Monitoring:name=connectionStatuses" -A ConnectionStatuses -K eros.10.220.5.34-keepalive -w 200 -c 300'

Re: Need help with CHECK_JMX value

Posted: Fri Sep 01, 2017 3:17 pm
by tmcdonald
Thanks for the assist, @mcapra! OP, let us know if you need further assistance.

Re: Need help with CHECK_JMX value

Posted: Mon Sep 04, 2017 2:29 am
by wassimc
Hey mcapra.

I have tried that solution with no luck.

I get this when I run the command.

JMX CRITICAL - 300is not of type Number,String or Boolean.

I'am trying to monitor a old self-developed solution here at work (not something that I have been involved in). The system handles signals from different systems and runs Activemq & Tomcat.

Re: Need help with CHECK_JMX value

Posted: Tue Sep 05, 2017 12:13 pm
by mcapra
Hmm, assuming you are using the aforementioned version of check_jmx, that error indicates bad inputs for the warning/critical args:
https://github.com/WillPlatnick/jmxquer ... #L215-L231

Very strange. Can you share the full output of the following commands executed from the CLI of your Nagios XI machine:

Code: Select all

/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.197.25:8099/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 4248302272 -c 5498760192


/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://192.168.197.25:8099/jmxrmi -O "STEP Monitoring:name=connectionStatuses" -A ConnectionStatuses -K eros.10.220.5.34-keepalive -vvvv -w 200 -c 300
Could you also attach copies of your check_jmx and jmxquery.jar? They might be useful to have for comparison.

Re: Need help with CHECK_JMX value

Posted: Tue Sep 05, 2017 3:16 pm
by dwhitfield
Thanks @mcapra!

OP, I fully agree with mcapra, but as I see you are new to the forums, I just want to note that you will need to set up a command in XI to go with this check. It looks like you can skip the first bit of https://assets.nagios.com/downloads/nag ... ios-XI.pdf, but the rest should be useful.