views:

469

answers:

3

Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got.

java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage"

Here's what I get.

JMX CRITICAL Authentication failed! Credentials required

I got the credentials, but how do I pass them to JMXQuery?

/Ace

+1  A: 

According to the source, you should be able to use -username and -password arguments.

http://code.google.com/p/jmxquery/source/browse/trunk/src/main/java/jmxquery/JMXQuery.java?r=3

KC Baltz
A: 

It seems that this is an addon to the original JMX-query, look at the comment field.

/** * * JMXQuery is used for local or remote request of JMX attributes * It requires JRE 1.5 to be used for compilation and execution. * Look method main for description how it can be invoked. * * This plugin was found on nagiosexchange. It lacked a username/password/role system. * * @author unknown * @author Ryan Gravener ([email protected]) *
*/

Does that mean that there's no way to remotely access JMX with original JMXQuery? If so, what can you do with it?

Ace
A: 

java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A NonHeapMemoryUsage -K used -I NonHeapMemoryUsage -J used -vvvv -w 82208358 -c 105696461 -username monitorRole -password changeme