Apache Tomcat is an open source Java servlet container that implements several core Java enterprise specs, namely the Java Servlet, JavaServer Pages (JSP), and WebSockets APIs. An Apache Software Foundation project, Tomcat was first released in 1998, just four years after Java itself. It is developed and maintained by an active and open community and it was released under the Apache License 2.0.

At a base level, Apache Tomcat is designed to offer developers access to a "pure Java" HTTP web server environment that they can then use to run Java code. Over the years, a number of important features have been added to make this process as efficient as possible. One of them is the cluster — something that was added to help manage large applications in particular. The cluster is particularly important for load balancing and it requires JDK version 1.5 or higher. A high availability feature was also added to help better facilitate the scheduling of important system upgrades. This can include but is not limited to change requests, new releases and more. All of this can now take place without impacting the live environment in any way, thus offering superior performance to end users without disruption.

This high availability feature is accomplished by dispatching live traffic requests to a temporary server on a different port, all while the main server is being upgraded (or modified in some way) on the main port. As a result, it has become very helpful in terms of handling the user requests on high-traffic web applications.

Why use a Telegraf plugin for Apache Tomcat?

Your Tomcat server is an integral part of your web application, so maintaining a performant Tomcat server is key. Monitoring your Tomcat server will ensure that your application responds to requests without significant delays, in addition to identifying any potential errors or memory leaks in your code.

How to monitor Apache Tomcat using the Telegraf plugin

The Apache Tomcat Telegraf plugin collects metrics available from the Tomcat manager status page from the http://<host>/manager/status/all?XML=true URL. (XML=true will return only xml data). This makes it easy to collect Tomcat metrics in InfluxDB to help you understand the behavior and performance of this server.

Configure the Apache Tomcat Telegraf Plugin with the location of your server and authentication information, and it will start collecting data into InfluxDB in no time.

To properly configure the Apache Tomcat Telegraf Plugin in your own environment, simply use the following commands. Replace all defaults and placeholders with values relevant to your particular deployment:

# Gather metrics from the Tomcat server status page.
[[inputs.tomcat]]
  ## URL of the Tomcat server status
  # url = "http://127.0.0.1:8080/manager/status/all?XML=true"

  ## HTTP Basic Auth Credentials
  # username = "tomcat"
  # password = "s3cret"

  ## Request timeout
  # timeout = "5s"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

Key Apache Tomcat metrics to use for monitoring

Some of the important Apache Tomcat metrics that you should proactively monitor include information about the Tomcat connectors, and JVM memory usage such as:

Measurements & Fields:

  • tomcat_jvm_memory
    • free
    • total
    • max
  • tomcat_jvm_memorypool
    • max_threads
    • current_thread_count
    • current_threads_busy
    • max_time
    • processing_time
    • request_count
    • error_count
    • bytes_received
    • bytes_sent
  • tomcat_connector
    • max_threads
    • current_thread_count
    • current_thread_busy
    • max_time
    • processing_time
    • request_count
    • error_count
    • bytes_received
    • bytes_sent

Tags:

  • tomcat_jvm_memorypool has the following tags:
    • name
    • type
  • tomcat_connector
    • name

For more information, please check out the documentation.

Project URL   Documentation

Related Resources

Infrastructure and application monitoring

The solution to monitor your entire infrastructure stack, including servers, containers, databases and cloud services.

Linux System Monitoring Template

Learn how to use Linux System Monitoring Template by reading this page.

Tomcat Monitoring Template

Learn how to use the Tomcat Monitoring Template by reading this page.

Scroll to Top