Tuesday, November 12, 2013

Monitor Java app server via JMX and sitescope

Problem Statement: There was a need to monitor the JVM level stats from the application during performance testing other than normal system level stats.

Solution: Our target system was hosted on Tomcat 6.0 on a windows box (64-bit); to enable to monitor the JVM level params you can always enable JMX and monitor via Jconsole or VisualVM.

To enable JMX Settings on your application add the following lines to your startup script (or tomcat6w.exe in this case):

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port="JMX Port"
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

If your server is behind a firewall then you will not be able to access the JMX via JConsole or VisualVM; even though the telnet to JMX port shows that the port is running and accessible.

In that case you need to add another entry in the java params:
-Djava.rmi.server.hostname="IP Address of system"


Restart the tomcat service (or your java app server); now you should be able to access it through Jconsole or VisualVM on remote machines.


If you want to configure this on sitescope then you need to do is add a JMX monitor and provide the JMX URL to connect to that JVM as shown below:
service:jmx:rmi:///jndi/rmi://"Server Name":"JMX Port"/jmxrmi
Once this is done, select the appropriate counters to monitor in sitescope; once configured add it to your controller / PC scenario. This will enable you to store the values into your test results and analyse them later.

No comments: