The OpenTelemetry Collector provides an integration with Apache Tomcat to ingest metrics. When configured to use the JMX/Tomcat integration, the Collector fetches metrics from a target MBean server using built-in profiles for Tomcat. From there the metrics are processed and exported to Lightstep Observability.
To complete the integration, you will:
- Configure a JMX remote connection for the Collector on the Java Virtual Machine
- Configure the JMX receiver for the Collector to ingest Tomcat metrics
- Enable the integration by adding it to a pipeline
- Tomcat v5 or later
- Download OpenTelemetry JMX Metric JAR release version 1.9 or later.
- The path to the
- You’ve configured the Collector to export data to Lightstep Observability.
Configure a JMX remote connection for the Collector receiver to connect to the executing Java Virtual Machine.
This example shows JMX configuration (without authentication) by setting the
CATALINA_OPTS environment variable:
1 2 3 4 export CATALINA_OPTS=-Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.port=$PORT_NUMBER \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false
For more details regarding configuring the Tomcat remote connection, see the official Tomcat documentation.
Configure the Collector receiver
Add JMX/Tomcat as a receiver and set the following:
jar_path: The path to the OpenTelemetry JMX metrics jar file.
endpoint: The endpoint of the host:port for the running application. This should be the same port used in the JMX configuration, above.
target_system: The metrics to collect. Values can this integration are
1 2 3 4 5 6 7 receivers: jmx/tomcat: # Default is /opt/opentelemetry-java-contrib-jmx-metrics.jar jar_path: /opt/opentelemetry-jmx-metrics.jar endpoint: tomcat:9090 # Required. target_system: jvm,tomcat # Required.
The OpenTelemetry repo’s readme provides additional details about JMX configuration.
Enable the Collector receiver
Once the Tomcat receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.
Validate metrics are reporting to Lightstep
You can validate that the metrics are reporting to Lightstep from the Metric details section of the Project Settings page.
Open the Project settings page and scroll to the Metric details section.
Search for Tomcat metric names.
If needed, click on the metric to edit the description and how the units are displayed in Lightstep.
Create a dashboard for the metrics
Use the Lightstep Terraform Provider to create a dashboard for the metrics.
For a more complete example that’s ready to run, see the Tomcat integration in Lightstep OpenTelemetry Examples.