Page 1 of 1

Monitor JMX with Nagios for space on name

Posted: Tue May 30, 2017 5:29 am
by geopc
We are trying to monitor JMX with Nagios XI and using check_jmx Plugin. Its working fine for Heap memory, thread count etc..We re facing issue on while using the following:

obj": "java.lang:type=MemoryPool,name=Par Eden Space",
"attr": [
"Usage"] ],

"obj": "java.lang:type=GarbageCollect=r,name=PS MarkSweep",
attributes: [CollectionCount,
CollectionTime]

We tried varios options but as there is space in name its no getting. SO can anyon ehelp how we can specify name with spaces.

Code: Select all

check_jmx -U service:jmx:rmi:///jndi/rmi://localhost:9199/jmxrmi -O java.lang:type=GarbageCollector,name='PS MarkSweep' -A CollectionCount -K duration -u ms -vvvv -w 10 -c 10

Code: Select all

JMX CRITICAL java.lang:type=GarbageCollector,name=PS connecting to java.lang:type=GarbageCollector,name=PS by URL service:jmx:rmi:///jndi/rmi://localhost:9199/jmxrmijavax.management.InstanceNotFoundException: java.lang:type=GarbageCollector,name=PS
Can any one please help us.

Re: Monitor JMX with Nagios for space on name

Posted: Tue May 30, 2017 9:11 am
by mcapra
Which version of check_jmx and jmxquery are you using? I would recommend this one if possible:
https://github.com/WillPlatnick/jmxquery

My JVM doesn't support/use PS MarkSweep, but the plugin above at least appears to be structuring the request correctly using your provided syntax:

Code: Select all

/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://testbench:9004/jmxrmi -O java.lang:type=GarbageCollector,name='PS MarkSweep' -A CollectionCount -K duration -u ms -vvvv -w 10 -c 10
Returns this (i've highlighted the relevant bits):

JMX CRITICAL - java.lang:type=GarbageCollector,name=PS MarkSweep connecting to java.lang:type=GarbageCollector,name=PS MarkSweep by URL service:jmx:rmi:///jndi/rmi://testbench:9004/jmxrmijavax.management.InstanceNotFoundException: java.lang:type=GarbageCollector,name=PS MarkSweep

Re: Monitor JMX with Nagios for space on name

Posted: Tue May 30, 2017 10:48 am
by tmcdonald
Thanks for the post, @mcapra! OP, let us know if you have further questions.