Tomcat plugin

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


Even if the Tomcat plugin is not configured, Stackdriver Monitoring discovers Tomcat services as a web server.

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, Monitoring populates the Tomcat Services page with inventory and metrics.

Configuring 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.


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

Enabling the Tomcat monitoring plugin

Tomcat is monitored via JMX. 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/ && sudo curl -O

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, as root, 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

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.

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

For details, see Agent metrics list: Tomcat and Agent metrics list: JVM.

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).

Was this page helpful? Let us know how we did:

Send feedback about...

Stackdriver Monitoring
Need help? Visit our support page.