Thursday, August 30, 2012

How to enable jmx-agent to monitor a java process from remote machine:

A quick tip on how to enable jmx-agent to monitor a java process from remote machine:

Add following system property in the java process while starting it: “-Dcom.sun.management.jmxremote.port=<port number>”
 
We can add security features as well to it: 
For example, (run com.example.MyApp with jmx-agent enabled) 
% java -Dcom.sun.management.jmxremote.port=3000
-Dcom.sun.management.jmxremote.password.file=password.properties
-Dcom.sun.management.jmxremote.access.file=access.properties
-Djavax.net.ssl.keyStore=keystore
-Djavax.net.ssl.keyStorePassword=password
com.example.MyApp