Tomcat monitoring through JMX console

Monitoring is required for any process to see how the system behaves on current settings and how much we need to improve for better performance. Tomcat is container for running any java based application ,when we deployed any application in tomcat we might need to check performance of the container. Monitoring that includes number of threads handled,CPU usage,Heap Usage etc. Tomcat provides a nice feature to monitor all through jconsole. Now all we need to do is just enable it as like below.
In Linux/Unix/Solaris:
export JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

In Windows:
set JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

We can add above lines in setenv.bat or setenv.sh files in bin foler tomcat installation.This file may not exists by default, if the file is not available we can create it. Now restart the tomcat.Since we are enabling in our local machine host can be either localhost or and port is 10999.If your monitoring the remote server enter your host as remote server IP.
Jconsole tool available in bin folder of java installation. If java environment variable is already set we can run like below to get the jconsole.
After launched the jconsole we need to input following url in the remote process. No need to give any user name and password,Click connect button. We might get insecure warning and confirm it.
Now we should able to see all relevant information in jmx monitoring.


Post a Comment

Powered by Blogger.