Tomcat Plugin

Tomcat is a popular open source implementation of the Java Servlet specification. For more information visit tomcat.apache.org.

Discovery

Even if the Tomcat plugin is not configured, Stackdriver Monitoring will discover Tomcat services as a webserver.

The services discovered are displayed on the Tomcat Services page in the Resources menu. After you install the monitoring agent and configure the Tomcat plugin on your instances, Stackdriver Monitoring populates the Tomcat Services page with inventory and metrics.

Configuring Stackdriver Monitoring to monitor Tomcat

After you install the monitoring agent, use the following instructions to configure the Tomcat plugin on your instances. For instructions on upgrading from the legacy jmxtrans monitoring, see Upgrading from jmxtrans below.

Prerequisites

The Tomcat plugin requires version 5.5.0-257 or later of the monitoring agent. To update the agent, see Upgrading the agent.

Tomcat must be set to enable external JMX monitoring. See the JMX documentation at tomcat.apache.org.

Enabling the Tomcat monitoring plugin

Tomcat is monitored via JMX. Stackdriver Monitoring supports monitoring Tomcat version 7. Tomcat version 8 is not currently supported.

On your VM instance, download tomcat-7.conf from the GitHub configuration repository and place it in the directory /opt/stackdriver/collectd/etc/collectd.d/:

(cd /opt/stackdriver/collectd/etc/collectd.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/tomcat-7.conf)

The downloaded plugin configuration file assumes that your Tomcat instance is configured to accept JMX connections on port 9012. If you have configured Tomcat with a different JMX port, edit the file and follow the instructions to change the JMX port settings.

After adding the configuration file, restart the monitoring agent by running the following command:

sudo service stackdriver-agent restart

Information on other plugin configuration options can be found at collectd.org.

What is monitored

The Tomcat plugin monitors the following metrics:

  • Threads: Total and busy threads in the Tomcat process.
  • Requests: The number of completed and error requests that took place.
  • Sessions: How many sessions are active in Tomcat.

Stackdriver Monitoring also monitors the following basic JVM metrics:

  • Active JVM Threads
  • JVM Heap memory usage
  • JVM Non-Heap memory usage
  • JVM Open File Descriptors
  • JVM Garbage Collection Count

Upgrading from jmxtrans

If you are currently running a VM with the legacy jmxtrans monitoring, you need to upgrade all of the Java-based plugins, namely Cassandra, HBase, Kafka, or Tomcat. After you've upgraded those plugins and restarted the stackdriver-agent service, you can shut down the jmxtrans process. You can then uninstall jmxtrans by removing the /mnt/jmxtrans tree and the /etc/init.d/jmxtrans script (if the script is present).

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Stackdriver Monitoring