Tomcat

Note

This plugin is currently being groomed to be an integration. It works, but we haven’t spent a lot of time on it yet to optimize the user experience. Feel free to try it out, just keep in mind that we will be enhancing the experience over time.

Overview

This plugin collects status metrics from Tomcat.

Note

This plugin is currently only available for x86_64 Linux.

Setup

The tomcat plugin is included with the AppOptics host agent by default, please follow the directions below to enable it for a host agent instance.

Prerequisites

This plugin requires that the a user with the manager-status (or any other manager-xxx) role. You can verify the credentials by testing the manager URL:

curl -u tomcat:tomcat "http://127.0.0.1:8080/manager/status/all?XML=true"
# response
<?xml version="1.0" encoding="utf-8"?>
<status>
    <jvm>
        <memory free="398919744" total="514850816" max="954728448" />
        <memorypool name="PS Eden Space" type="Heap memory" usageInit="134742016" usageCommitted="134742016" usageMax="313524224" usageUsed="115931072" />
        <memorypool name="PS Old Gen" type="Heap memory" usageInit="358088704" usageCommitted="358088704" usageMax="716177408" usageUsed="0" />
        <memorypool name="PS Survivor Space" type="Heap memory" usageInit="22020096" usageCommitted="22020096" usageMax="22020096" usageUsed="0" />
        <memorypool name="Code Cache" type="Non-heap memory" usageInit="2555904" usageCommitted="6356992" usageMax="251658240" usageUsed="6296704" />
        <memorypool name="Compressed Class Space" type="Non-heap memory" usageInit="0" usageCommitted="2228224" usageMax="1073741824" usageUsed="2055160" />
        <memorypool name="Metaspace" type="Non-heap memory" usageInit="0" usageCommitted="18743296" usageMax="-1" usageUsed="18251480" />
    </jvm>
    <connector name="ajp-nio-8009">
        <threadInfo maxThreads="200" currentThreadCount="10" currentThreadsBusy="0" />
        <requestInfo maxTime="0" processingTime="0" requestCount="0" errorCount="0" bytesReceived="0" bytesSent="0" />
        <workers></workers>
    </connector>
    <connector name="http-nio-8080">
        <threadInfo maxThreads="200" currentThreadCount="10" currentThreadsBusy="1" />
        <requestInfo maxTime="0" processingTime="0" requestCount="0" errorCount="0" bytesReceived="0" bytesSent="0" />
        <workers>
            <worker stage="S" requestProcessingTime="91" requestBytesSent="0" requestBytesReceived="0" remoteAddr="127.0.0.1" virtualHost="127.0.0.1" method="GET" currentUri="/manager/status/all" currentQueryString="XML=true" protocol="HTTP/1.1" />
        </workers>
    </connector>
</status>

There is more information about how to configure manager application access here.

Configuration

The host agent provides an example configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent, but requires you to provide the correct settings for your Apache server. To enable the plugin:

  1. Make a copy of the tomcat example configuration file /opt/appoptics/etc/plugins.d/tomcat.yaml.example, renaming it to /opt/appoptics/etc/plugins.d/tomcat.yaml:

    $ sudo cp /opt/appoptics/etc/plugins.d/tomcat.yaml.example /opt/appoptics/etc/plugins.d/tomcat.yaml
    
  2. Update /opt/appoptics/etc/plugins.d/tomcat.yaml configuration file with settings specific to your Tomcat servers, for example:

    collector:
      tomcat:
        all:
          ## 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: "tomcat"
          ## Request timeout
          # timeout: "5s"
          ## Optional SSL Config
          # ssl_ca: "/etc/telegraf/ca.pem"
          # ssl_cert: "/etc/telegraf/cert.pem"
          # ssl_key: "/etc/telegraf/key.pem"
          ## Use SSL but skip chain & host verification
          # insecure_skip_verify: false
    
    load:
      plugin: snap-plugin-collector-bridge-tomcat
      task: task-bridge-tomcat.yaml
    
  3. Restart the host agent:

    $ sudo service appoptics-snapteld restart
    
  4. Enable the Tomcat plugin

On the Integrations Page you will see Tomcat available if the previous steps were successful.

Metrics and Tags

The table below lists each of the metrics gathered from the status endpoint.

Connector Metrics

Metric Description
tomcat.tomcat_connector.bytes_received Total bytes received
tomcat.tomcat_connector.bytes_sent Total bytes sent
tomcat.tomcat_connector.current_thread_count Total thread count
tomcat.tomcat_connector.current_threads_busy Total busy thread
tomcat.tomcat_connector.error_count Total error count
tomcat.tomcat_connector.max_threads Max thread count
tomcat.tomcat_connector.max_time Max response time
tomcat.tomcat_connector.processing_time Max processing time
tomcat.tomcat_connector.request_count Request count

Connector Metric Tag

Name Description
name Name of the web app

JVM Memory Metrics

Metric Description
tomcat.tomcat_jvm_memory.free Free memory in bytes
tomcat.tomcat_jvm_memory.max Max memory in bytes
tomcat.tomcat_jvm_memory.total Total memory in bytes
tomcat.tomcat_jvm_memorypool.committed Committed memory in bytes
tomcat.tomcat_jvm_memorypool.init Initial memory in bytes
tomcat.tomcat_jvm_memorypool.max Max used memory in bytes
tomcat.tomcat_jvm_memorypool.used Used memory in bytes

JVM Metric Tag

Name Description
name Name of the web app
space Name of the space