See the JMX Check documentation for a list of configuration options usable by all JMX-based checks.
List of metrics
The conf parameter is a list of metrics to be collected by the integration. Only two keys are allowed:
include (mandatory): A dictionary of filters. Any attribute that matches these filters is collected unless it also matches the exclude filters (see below).
exclude (optional): A dictionary of filters. Attributes that match these filters are not collected.
For a given bean, metrics get tagged in the following manner:
mydomain:attr0=val0,attr1=val1
In this example, your metric is mydomain (or some variation depending on the attribute inside the bean) and has the tags attr0:val0, attr1:val1, and 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 Datadog as my_metric_name.
The attribute filter
The attribute filter can accept two types of values:
A dictionary whose keys are attributes names (see below). For this case, you can specify an alias for the metric that becomes the metric name in Datadog. You can also specify the metric type as a gauge or counter. If you choose counter, a rate per second is computed for the metric.
To submit logs to Datadog, Tomcat uses the log4j logger. For versions of Tomcat before 8.0, log4j is configured by default. For Tomcat 8.0+, you must configure Tomcat to use log4j, see Using Log4j. In the first step of those instructions, edit the log4j.properties file in the $CATALINA_BASE/lib directory as follows:
Collecting logs is disabled by default in the Datadog Agent, enable it in your datadog.yaml file:
logs_enabled:true
Add this configuration block to your tomcat.d/conf.yaml file to start collecting your Tomcat Logs:
logs:- type:filepath:/var/log/tomcat/*.logsource:tomcatservice:"<SERVICE>"#To handle multi line that starts with yyyy-mm-dd use the following pattern#log_processing_rules:# - type: multi_line# name: log_start_with_date# pattern: \d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])
Change the path and service parameter values and configure them for your environment. See the sample tomcat.yaml for all available configuration options.
The maximum number of allowed worker threads. Shown as thread
tomcat.threads.count (gauge)
The number of threads managed by the thread pool. Shown as thread
tomcat.threads.busy (gauge)
The number of threads that are in use. Shown as thread
tomcat.bytes_sent (gauge)
Bytes per second sent by all the request processors. Shown as byte
tomcat.bytes_rcvd (gauge)
Bytes per second received by all request processors. Shown as byte
tomcat.error_count (gauge)
The number of errors per second on all request processors. Shown as error
tomcat.request_count (gauge)
The number of requests per second across all request processors. Shown as request
tomcat.max_time (gauge)
The longest request processing time (in milliseconds). Shown as millisecond
tomcat.processing_time (gauge)
The sum of request processing times across all requests handled by the request processors (in milliseconds) per second.
tomcat.servlet.processing_time (gauge)
The sum of request processing times across all requests to the servlet (in milliseconds) per second.
tomcat.servlet.error_count (gauge)
The number of erroneous requests received by the servlet per second. Shown as error
tomcat.servlet.request_count (gauge)
The number of requests received by the servlet per second. Shown as request
tomcat.cache.access_count (gauge)
The number of accesses to the cache per second. Shown as get
tomcat.cache.hits_count (gauge)
The number of cache hits per second. Shown as hit
tomcat.string_cache.access_count (gauge)
The number of accesses to the string cache per second. Shown as get
tomcat.string_cache.hit_count (gauge)
The number of string cache hits per second. Shown as hit
tomcat.web.cache.lookup_count (gauge)
The number of lookups to the web resource cache per second. Shown as get
tomcat.web.cache.hit_count (gauge)
The number of web resource cache hits per second. Shown as hit
tomcat.jsp.count (gauge)
The number of JSPs per second that have been loaded in the web module. Shown as page
tomcat.jsp.reload_count (gauge)
The number of JSPs per second that have been reloaded in the web module. Shown as page
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. Statuses: ok, critical
Troubleshooting
Missing tomcat.* metrics
The integration collects default Tomcat metrics from the Catalina bean domain name. If exposed Tomcat metrics are prefixed with a different bean domain name, such as Tomcat, copy the default metrics from the metrics.yaml to the conf section of the tomcat.d/conf.yaml and modify the domain filter to use the applicable bean domain name.
The datadog-agent jmx command was added in version 4.1.0.
List attributes that match at least one of your instance configurations:
sudo /etc/init.d/datadog-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/datadog-agent jmx list_limited_attributes
List attributes that are actually collected by your current instance configurations:
sudo /etc/init.d/datadog-agent jmx list_collected_attributes
List attributes that don’t match any of your instance configurations:
sudo /etc/init.d/datadog-agent jmx list_not_matching_attributes
List every attribute available that has a type supported by JMXFetch:
sudo /etc/init.d/datadog-agent jmx list_everything
Start the collection of metrics based on your current configuration and display them in the console:
sudo /etc/init.d/datadog-agent jmx collect
Further Reading
Additional helpful documentation, links, and articles: