JMXQuery connection - authentication failed
-
02-07-2019 - |
Question
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
Solution
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
OTHER TIPS
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 (ryangravener@gmail.com) *
*/
Does that mean that there's no way to remotely access JMX with original JMXQuery? If so, what can you do with it?
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
You can download a version of check_jmx that works with --username and --password from http://snippets.syabru.ch/nagios-jmx-plugin/download.html