Monitor JMX with Nagios for space on name

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
geopc
Posts: 7
Joined: Tue May 30, 2017 5:22 am

Monitor JMX with Nagios for space on name

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor JMX with Nagios for space on name

Post 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
Former Nagios employee
https://www.mcapra.com/
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitor JMX with Nagios for space on name

Post by tmcdonald »

Thanks for the post, @mcapra! OP, let us know if you have further questions.
Former Nagios employee
Locked