Skip to content

Apache Tomcat Monitoring

Apache Tomcat

Apache Tomcat is an open-source web server which can be monitored using the JMX protocol. In order to monitor a Tomcat web server, it must be configured to enable JMX monitoring connections.

Supported versions

Apache Tomcat 7 and above can be monitored. Both anonymous and authenticated JMX connections are supported.

Enabling JMX Remote

To enable JMX monitoring connections on Tomcat, please follow the relevant procedure depending on the operating system. TomcatHome refers to tomcat installation folder. The procedures below are inspired from Tomcat documentation explaining how to enable JMX remoting.


  • Create a file named and put inside:


Create a file named setenv.bat and put inside:


Optional Authentication

Enabling authentication is optional. Authentication protects your server JMX endpoint from being accessible to anyone. An alternative to authentication is to filter access to JMX port (9004 by default) using IPTables.

Enabling authentication

  • Add the following JVM parameters to CATALINA_OPTS:
  • Edit the file $CATALINA_BASE/conf/jmxremote.access:
MonitorRole readonly
controlRole readwrite
  • Edit the file $CATALINA_BASE/conf/jmxremote.password:
MonitorRole tomcat
controlRole tomcat


Apache Tomcat Wizard

Apache Tomcat Configuration Wizard.

The Apache Tomcat monitor requires the following settings:

  • Hostname: hostname or IP of the Apache Tomcat server. It must be reachable from the monitoring agent container,
  • Port: JMX Remoting port, 9004 by default,
  • Domain: Defines the Apache Tomcat MBeans domain. Catalina is by default,
  • Authentication: Optionally define username and password.


To tailor a monitor counter list fitting the monitored system, the Apache Tomcat monitor asks to select the web applications to monitor.

Apache Tomcat Applications

Apache Tomcat Applications Selection.

In this configuration step, a table lists all the web applications deployed on the Tomcat server. select the deployed web applications to monitor then click on Next.

Monitored Counters

Apache Tomcat Counters

Apache Tomcat Counters Selection.

The Apache Tomcat monitoring module collects the following metrics:

  • Sessions:

    • {hostname}:

      • {webapp}:

        • activeSessions: Number of currently active sessions,
        • sessionCounter: Total number of created sessions,
        • maxActive: Max number of active sessions,
        • sessionMaxAliveTime: Max session alive time in ms,
        • sessionAverageAliveTime: Average session alive time in ms,
        • rejectedSessions: Number of rejected sessions,
        • expiredSessions: Number of expired sessions,
        • % rejectedSessions: Percent of rejected sessions.
  • RequestProcessor:

    • {processor}:

      • requestCount: Number of requests received,
      • errorCount: Number of errors encountered,
      • bytesSent: Number of bytes sent,
      • maxTime: Maximum processing time since server startup in ms,
      • processingTime: Current processing time in ms,
      • % errorCount: Percent of errors encountered (errorCount / requestCount).
  • DataSource:

    • {hostname}:

      • {webapp}:

        • {datasource}:

          • numActive: Number of active JDBC connections,
          • numTestsPerEvictionRun: determines the number of objects examined in each run of the idle object evictor,
          • numIdle: Number of idle JDBC connections,
          • maxActive: Maximum number of active JDBC connections since server startup,
          • % numActive: Percent of active JDBC connections,
          • maxIdle: Maximum of idle JDBC connections since server startup,
          • poolConfiguration: Textual JDBC connections pool configuration.
  • ThreadPool:

    • {threadpool}:

      • currentThreadsBusy: Current number of threads being busy,
      • currentThreadCount: Current number of threads being alive,
      • maxThreads: Maximum number of threads the pool can spawn,
      • threadsConfiguration: Textual thread pool configuration.
  • JVM:

    • Memory:

      • used: memory used by the JVM in bytes,
      • commited: memory commited by the JVM in bytes,
      • max: max JVM memory in bytes,
      • % used: Percent used memory (used / max).
    • Garbage Collector:

      • {gcname}:

        • CollectionCount: Number of garbage collections,
        • CollectionTime: Time spend in garbage collection.
    • Threading:

      • ThreadCount: Number of threads currently running in the JVM,
      • DaemonThreadCount: Number of daemon threads currently running in the JVM,
      • PeakThreadCount: Maximum number of threads running since JVM startup.
  • Configuration:

    • Operating System:

      • Host: operating system host configuration (CPU, RAM and Swap),
    • Runtime:

      • JVM: Textual Java Virtual Machine name and version.

The available counters may vary depending on the Tomcat version being monitored.