It's very common requirement to monitor the memory utilization by our application. This can be done with JConsole. We can monitor JVM on local machine or on remote machine with JConsole.
Firstly we have to run the JConsole, it can be done as:
Now you can monitor any local process as shown in above image or you can monitor any process on remote machine. Monitoring process on remote machine involves some additional steps, we consider here to monitor tomcat on remote server as:
Firstly we have to run the JConsole, it can be done as:
- Go to bin folder of your JDK and run the jconole.exe file.
- Open command line and change directory to bin folder of JDK folder and write jconsole.exe and press enter.
Now you can monitor any local process as shown in above image or you can monitor any process on remote machine. Monitoring process on remote machine involves some additional steps, we consider here to monitor tomcat on remote server as:
- Go to tomcat folder and locate setenv.bat file(if it does not exist then create an empty file in conf folder). Then add the below lines in setenv.bat file.
set CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=PORT number -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
If you want to further authenticate the monitoring then follow the link
https://tomcat.apache.org/tomcat-8.0-doc/monitoring.html
- Restart tomcat server.
- Open JConsole on you system. Select "Remote Process" and enter IP address of remote server with port you have given in step 1.