Skip to content

Tomcat Integration

image

Infrastructure Integration

Overview

With Tomcat integration, you can monitor metrics like: - Request count, processing time, bytes sent/received - Thread count, busy threads & maximum allowed worker threads - Servlet request count, processing times

and more.

Instructions

Follow the installation guide below for your given collector environment.

During installation, use the configuration section below as reference.

After installation, the infrastructure datasources in the table below will be available in the AOC.

Installation Guide

Installing this integration consists of creating a yaml file in the filesystem of your collectors. Click below for instructions on how to do so for your given collectors environment.

Docker

Kubernetes

Mesos-Marathon

Debian

Ubuntu

RHEL/CentOS

SUSE

Configuration

This is a JMX based integration, so you need to enable the same in your tomcat servers. Follow Tomcat documentation to enable it. Edit tomcat.yaml to configure the agent. The configuration file is a dictionary of infrastructure datasources to collect metrics from. Please refer tomcat.yaml for all available configuration options.

Restart the agent after editing the file.

Note: In the example below, the port mentioned is JMX remote port for this tomcat server.

    instances:
      - host: localhost
        port: 9012               # JMX remote port

    init_config:
      conf:
        - include:
        type: ThreadPool
        attribute:
          maxThreads:
            alias: tomcat.threads.max
            metric_type: gauge
          currentThreadCount:
            alias: tomcat.threads.count
            metric_type: gauge
          currentThreadsBusy:
            alias: tomcat.threads.busy
            metric_type: gauge
        - include:
        type: GlobalRequestProcessor
        attribute:
          bytesSent:
            alias: tomcat.bytes_sent
            metric_type: counter
          bytesReceived:
            alias: tomcat.bytes_rcvd
            metric_type: counter
          errorCount:
            alias: tomcat.error_count
            metric_type: counter
          requestCount:
            alias: tomcat.request_count
            metric_type: counter
          maxTime:
            alias: tomcat.max_time
            metric_type: gauge
          processingTime:
            alias: tomcat.processing_time
            metric_type: counter

Configuration options:

The instances parameter in the configuration file can have below options

Option Required Description
host and port No Host and port to connect to.
user and password No Username and password
process_name_regex No Instead of specifying a host and port or jmx_url, the Agent can connect using the attach api. This requires the JDK to be installed and the path to tools.jar to be set.
tools_jar_path No Should be set when process_name_regex is set.
java_bin_path No Should be set if the Agent cannot find your java executable.
java_options No Java JVM options
trust_store_path and trust_store_password No Should be set if com.sun.management.jmxremote.ssl is set to true on the target JVM.
key_store_path and key_store_password No Should be set if com.sun.management.jmxremote.ssl.need.client.auth is set to true on the target JVM.
rmi_registry_ssl No Should be set to true if com.sun.management.jmxremote.registry.ssl is set to true on the target JVM.

The conf parameter must have one the two keys:

Key Required Description
include Yes A dictionary of filters. Any attribute that matches these filters are collected unless it also matches the “exclude” filters.
exclude No A dictionary of filters. Attributes that match these filters won’t be collected.

Validating Configuration

Run the command under Checking Runtime section of the installation guide applicable to your environment. Look for tomcat under the checks section in the command output. The output should look like this:

  Checks
  ======

    tomcat (5.23.0)
    ---------------
      - instance #tomcat-localhost-9012 *[OK]* collected 28 metrics
      - Collected 28 metrics, 0 events & 0 service checks

Infrastructure Datasources

Below are the available infrastructure datasources.

Datasource Available Aggregations Unit Description
tomcat.threads.max avg max min sum thread The maximum number of allowed worker threads.
tomcat.threads.count avg max min sum thread The number of threads managed by the thread pool.
tomcat.threads.busy avg max min sum thread The number of threads that are in use.
tomcat.bytes_sent avg max min sum byte/second Bytes per second sent by all the request processors.
tomcat.bytes_rcvd avg max min sum byte/second Bytes per second received by all request processors.
tomcat.error_count avg max min sum error/second The number of errors per second on all request processors.
tomcat.request_count avg max min sum request/second The number of requests per second across all request processors.
tomcat.max_time avg max min sum millisecond The longest request processing time (in milliseconds).
tomcat.processing_time avg max min sum The sum of request processing times across all requests handled by the request processors (in milliseconds) per second.
tomcat.servlet.processing_time avg max min sum The sum of request processing times across all requests to the servlet (in milliseconds) per second.
tomcat.servlet.error_count avg max min sum error/second The number of erroneous requests received by the servlet per second.
tomcat.servlet.request_count avg max min sum request/second The number of requests received by the servlet per second.
tomcat.cache.access_count avg max min sum get/second The number of accesses to the cache per second.
tomcat.cache.hits_count avg max min sum hit/second The number of cache hits per second.
tomcat.jsp.count avg max min sum page/second The number of JSPs per second that have been loaded in the web module.
tomcat.jsp.reload_count avg max min sum page/second The number of JSPs per second that have been reloaded in the web module.