Apache Tomcat
StackState curated integration
This page describes StackState v4.4.x.
The StackState 4.4 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.4 version range to upgrade to a more recent release.
Overview
This check collects Tomcat metrics, for example:
Overall activity metrics: error count, request count, processing times
Thread pool metrics: thread count, number of threads busy
Servlet processing times
And more.
Setup
Installation
The Tomcat check is included in the Agent V2 StackPack, so you don't need to install anything else on your Tomcat servers.
This check is JMX-based, so you need to enable JMX Remote on your Tomcat servers. Follow the instructions in the Tomcat documentation to do that.
Configuration
Edit the
tomcat.d/conf.yaml
file, in theconf.d/
folder at the root of your Agent's configuration directory to start collecting your Tomcat metrics and logs. See the sampletomcat.d/conf.yaml
for all available configuration options.Restart the Agent
Metric Collection
Add this configuration block to your
tomcat.yaml
file to start gathering your Tomcat metrics:
See the JMX Check documentation for a list of configuration options usable by all JMX-based checks. The page also describes how the Agent tags JMX metrics.
Restart the Agent to start sending Tomcat metrics to StackState.
Configuration Options:
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 is a list of dictionaries. Only 2 keys are allowed in this dictionary:
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.
For a given bean, metrics get tagged in the following manner:
Your metric is mydomain (or some variation depending on the attribute inside the bean) and has the tags attr0:val0, attr1:val1, domain:mydomain
.
If you specify an alias in an include
key that is formatted as camel case, it is converted to snake case. For example, MyMetricName
is shown in StackState as my_metric_name
.
See the sample tomcat.yaml
for all available configuration options.
The attribute filter
The attribute
filter accepts two types of values:
A dictionary whose keys are attributes names:
For the case above, the metric aliases specified become the metric name in StackState. Also, the metric type can be specified as a gauge or counter. If you choose counter, a rate per second is computed for this metric.
A list of attributes names:
In that case:
The metric type is a gauge
The metric name is
jmx.\[DOMAIN_NAME].\[ATTRIBUTE_NAME]
Here is another filtering example:
Log Collection
Tomcat uses by default the log4j
logger. To activate the logging into a file and customize the log format edit the log4j.properties
file in the $CATALINA_BASE/lib
directory as follows:
Check Tomcat logging documentation for more information about Tomcat logging capabilities.
Collecting logs is disabled by default in the StackState Agent, enable it in your
stackstate.yaml
file with:Add this configuration block to your
tomcat.d/conf.yaml
file to start collecting your Tomcat Logs:Change the
path
andservice
parameter values and configure them for your environment. See the sampletomcat.yaml
for all available configuration options.Restart the Agent.
Validation
Run the Agent's status subcommand and look for tomcat
under the Checks section.
Data Collected
Metrics
See metadata.csv
for a list of metrics provided by this check.
Events
The Tomcat check does not include any events.
Service Checks
tomcat.can_connect Returns CRITICAL
if the Agent is unable to connect to and collect metrics from the monitored Tomcat instance. Returns OK
otherwise.
Troubleshooting
Commands to view the metrics that are available:
List attributes that match at least one of your instance configurations:
sudo /etc/init.d/stackstate-agent jmx list_matching_attributes
List attributes that match one of your instance configurations but that are not collected because it would exceed the number of metrics that can be collected:
sudo /etc/init.d/stackstate-agent jmx list_limited_attributes
List attributes that are actually collected by your current instance configurations:
sudo /etc/init.d/stackstate-agent jmx list_collected_attributes
List attributes that don't match any of your instance configurations:
sudo /etc/init.d/stackstate-agent jmx list_not_matching_attributes
List every attribute available that has a type supported by JMXFetch:
sudo /etc/init.d/stackstate-agent jmx list_everything
Start the collection of metrics based on your current configuration and display them in the console:
sudo /etc/init.d/stackstate-agent jmx collect
Last updated