Monitoring is a key aspect of system administration. Looking inside a running server, obtaining some statistics or reconfiguring some aspects of an application are all daily administration tasks.
You always should monitor a Java application you deployed with Tomcat so here is a quick configuration cheatsheet about Tomcat 8.
Enable JMX remote monitoring
Add the following parameters to setenv.bat
or setenv.sh
script of your Tomcat:
set CATALINA_OPTS=-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=%my.jmx.port%
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
- If you require authorization, add and change this:
-Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access
- edit the access authorization file $CATALINA_BASE/conf/jmxremote.access:
monitorRole readonly controlRole readwrite
- edit the password file $CATALINA_BASE/conf/jmxremote.password:
monitorRole tomcat controlRole tomcat