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 a container for running any java based web application. We can  monitor 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 folder 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 127.0.0.1 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.

run

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.

service:jmx:rmi://localhost:10999/jndi/rmi://localhost:10999/jmxrmi

jconsole

Now we should able to see all relevant information in jmx monitoring.