JMX Metrics
This tutorial shows you how you can collect JMX metrics from Java services and use them in SigNoz.
There are three steps to collect JMX metrics from Java services and use them in SigNoz.
- Configure otel-collector to scrape JMX metrics
- Configure your Java service to expose JMX metrics
- Create a dashboard in SigNoz to plot the metrics
Steps to collect JMX metrics
Configure your Java service to expose JMX metrics
The Java service needs to be configured to expose JMX metrics. Update the JAVA_OPTS
environment variable to include the following arguments:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=<port-number-to-expose-jmx>
-Dcom.sun.management.jmxremote.rmi.port=<port-number-to-expose-jmx>
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Configure otel-collector to scrape JMX metrics
The OTel collector provides a JMX receiver component to scrape JMX metrics from Java services. It has the following configuration options:
jar_path
: Path to the JMX metrics gathering jar file. The jar file can be downloaded from https://github.com/open-telemetry/opentelemetry-java-contrib/releasesendpoint
: Endpoint of the Java service's JMX connection. Value must be in the form ofservice:jmx:<protocol>:<sap>
orhost:port
. Values inhost:port
form will be used to create a Service URL ofservice:jmx:rmi:///jndi/rmi://<host>:<port>/jmxrmi
.target_system
: Target system of the Java service's JMX connection. Must be a subset of:activemq
,cassandra
,hbase
,hadoop
,jetty
,jvm
,kafka
,kafka-consumer
,kafka-producer
,solr
,tomcat
,wildfly
. Accepts comma separated values.
Optional parameters:
username
: Username for the Java service's JMX connection.password
: Password for the Java service's JMX connection.
After downloading the jar file, add the following to the otel-collector-config.yaml file:
receivers:
jmx:
jar_path: /path/to/jmx_receiver.jar
endpoint: localhost:1099
target_system: cassandra,tomcat
Add the jmx
receiver to the metrics pipeline in the otel-collector-config.yaml file:
service:
pipelines:
metrics/jmx:
receivers: [jmx]
processors: [resourcedetection,batch]
exporters: [otlp]
Make sure to update the endpoint and target_system to match your Java service's JMX connection.
Create a dashboard in SigNoz to plot the metrics
Creating metrics dashboard in SigNoz
Some pre-configured dashboards are available in SigNoz. You can find them here.