check_jmx with certificate

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
amit.ahuja
Posts: 113
Joined: Fri May 15, 2015 8:20 am

check_jmx with certificate

Post by amit.ahuja »

I am trying to use the check_jmx plugin to monitor remote devices that require an additional classpath with a certificate for authentication. I have followed the tutorials online and have the plugin correctly installed but when I run the command ./check_jmx -U service:jmx:rmi:///jndi/rmi://REMOTEADDRESS:PORT/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -vvvv -w 4248302272 -c 5498760192 it times out. Any help in how to import the needed certificate to connect to the remote devices using this plugin would be greatly appreciated
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_jmx with certificate

Post by rkennedy »

Can you please post your full check_jmx command definition?

This link (http://devops-abyss.blogspot.com/2010/0 ... d-ssl.html) suggests you'll need to add two additional variables.

Code: Select all

-Djavax.net.ssl.trustStore=[full path to keystore file] -Djavax.net.ssl.trustStorePassword=[your password]
Former Nagios Employee
amit.ahuja
Posts: 113
Joined: Fri May 15, 2015 8:20 am

Re: check_jmx with certificate

Post by amit.ahuja »

The command I posted was the full test command found on the pdf documentation for the check_jmx plugin: https://assets.nagios.com/downloads/nag ... ios-XI.pdf I have an updated version of the plugin which allows username and password fields which I am using. I am following up on the link you sent and working to see if that fixes my issue. Thanks for the reply.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_jmx with certificate

Post by rkennedy »

You're welcome. I imagine it will work as it's java options, and not dependent on the java file that's running.

I'll leave this open for now, let us know if you have any other questions.
Former Nagios Employee
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: check_jmx with certificate

Post by haile711 »

rkennedy,

Does nagios has a keystore to import the cert in? Or do we have to create a keystore first? I'm a little confused with this part myself. I'm working on the same

Code: Select all

java -cp jmxquery.jar -Djavax.net.ssl.trustStore="/local/nagios/libexec/mashery-proxy.jks" -Djavax.net.ssl.trustStorePassword=xxxxx org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://10.72.48.125:8084/jmxrmi -O java.lang.type=Memory -A HeapMemoryUsage -K used
Thanks
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_jmx with certificate

Post by rkennedy »

You would need to create the java keystore yourself, import your cert(s), and use that in reference with the command.
Former Nagios Employee
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: check_jmx with certificate

Post by haile711 »

yea i've done that, and also see the cert in the keystore. I'm still getting connection refused.

Code: Select all

./check_jmx -Djavax.net.ssl.trustStore='/usr/local/nagios/libexec/mashery-proxy.jks' -Djavax.net.ssl.trustStorePassword=xxx org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://10.72.48.129:8084/jmxrmi -O "java.lang:type=MemoryPool,name=Perm Gen" -A Usage -K used -I Usage
JMX CRITICAL - Error opening RMI connection: Connection refused to host: xx.xx.xx.xxx; nested exception is:
        java.net.ConnectException: Connection timed out
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_jmx with certificate

Post by tgriep »

Can you add -vvvv to your command to get a verbose output and post that here?
Are you seeing any errors on the remote system?
Can you login to the XI server as root, run the following and post the output?

Code: Select all

ls -l /usr/local/nagios/libexec/mashery-proxy.jks
Be sure to check out our Knowledgebase for helpful articles and solutions!
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: check_jmx with certificate

Post by haile711 »

hey tgriep,
even tho i've added -vvv on the command it didn't produce any verbose output.
here is the output

Code: Select all

ls -l /usr/local/nagios/libexec/mashery-proxy.jks
-rw------- 1 root nagios 2901 Mar 25 10:17 /usr/local/nagios/libexec/mashery-proxy.jks
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_jmx with certificate

Post by rkennedy »

Can you show us the full input / output you're running?

Also, can you post the result of a nmap ipofjmxmachine?
Former Nagios Employee
Locked