Monitoring

Tomcat

LogicMonitor monitors Tomcat with two approaches:

  • HTTP to check the server availability and responsiveness
  • JMX to collect comprehensive internal server statistics

 

Monitoring Tomcat via HTTP

The datasource HTTP- and HTTPS- check the server availability and responsiveness by sending requests to 80 and 443.

If your Tomcat doesn't listen on the standard port, or you have multiple Tomcat instances running on the same box, you can update the  port list in the Active Discovery section of the datasources to add additional ports.

 

Monitoring Tomcat via JMX

LogicMonitor collects Tomcat internal statistics via JMX. To enable Tomcat JMX monitoring, please follow the steps below:

 

1. Enable JMX on your Tomcat application

To enable JMX monitoring without requiring a password, add the following parameters into theCATALINA_OPTS environment variable.

-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=%my.jmx.port% \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Djava.rmi.server.hostname=(The IP/DNS name of the server, as added to LogicMonitor) 

To enable JMX with password authentication, add the following properties:

-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=%my.jmx.port% \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=%my.conf.folder%/jmxremote.password \
-Dcom.sun.management.jmxremote.access.file=%my.conf.folder%/jmxremote.access \
-Djava.rmi.server.hostname=(The IP/DNS name of the server, as added to LogicMonitor)

Then edit the %my.conf.folder%/jmxremote.access file to include:

monitorRole readonly 

Then edit the %my.conf.folder%/jmxremote.password file to include:

monitorRole mypassword 

This creates a readonly user monitorRole with the password 'mypassword'.  For more information on configuring JMX for Tomcat, you can check here.

 

2. Set up device properties in LogicMonitor

Add the following three device properties to reflect what you have configured Tomcat JMX from Step 1:

  1. tomcat.jmxports = <jmx_port>
  2. jmx.user = <jmx_user>
  3. jmx.pass = <jmx_pass>

Note: If you run multiple tomcat instances on your servers, or use different ports on different servers, you can specify a comma separated list of ports to query for JMX information in the tomcat.jmxports variable.

After several minutes, the LogicMonitor will update its database and start collecting Tomcat internal stats via JMX.

2. Set up device properties in LogicMonitor

Tomcat Troubleshooting

If you finish the steps above, and find LogicMonitor still can't collect Tomcat internal stats, the failure is usually caused by network issue (e.g. firewall), Tomcat configuration, or incorrect username/password. You can use jconsole (part of the SUN JDK) to check the real reason.

Tomcat Troubleshooting