JVM
The JVM source collects metrics from a Java Virtual Machine over JMX. It connects to a JMX/RMI endpoint exposed by the target JVM and gathers the standard jvm target system metrics (heap and non-heap memory, garbage collection, threads, classes, and CPU) using the OpenTelemetry JMX metrics gatherer.
Supported Telemetry Types
Linux
✓
Windows
✓
macOS
✓
Prerequisites
The target JVM must have JMX remote enabled and be reachable from the collector host.
Start the target JVM with the JMX remote agent enabled, for example:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=falseThese settings are illustrative. Enable authentication and TLS in production. See the JDK Monitoring and Management Using JMX Technology guide for the full property reference.
The configured RMI port (default
9999) must be reachable from the collector host over the network.The OpenTelemetry JMX metrics gatherer JAR must be present on the collector host at the path set by JMX Metrics Collection Jar Path (default
/opt/opentelemetry-java-contrib-jmx-metrics.jar). The collector requires a Java runtime to execute it.
Configuration

Metrics
Address
String
No
localhost
IP address or hostname to scrape for JMX metrics.
Port
Integer
No
9999
Port to scrape for JMX metrics.
Advanced
JMX Metrics Collection Jar Path
String
No
/opt/opentelemetry-java-contrib-jmx-metrics.jar
Full path to the JMX metrics jar on the collector host.
Collection Interval
Integer
No
60
How often (seconds) to scrape for metrics.
Examples
Scrape a remote JVM over JMX
Collect JVM metrics from a Java application listening for JMX connections on app-host:9999, scraping every 30 seconds.
Configuration Tips
Enable JMX authentication (
com.sun.management.jmxremote.authenticate=true) and TLS (com.sun.management.jmxremote.ssl=true) on the target JVM in production. The JMX gatherer JAR supports user/password and TLS connections to the endpoint.The default 60 second collection interval is a good baseline. Lower it only when you need finer-grained memory or GC visibility, since shorter intervals increase load on both the JVM and the collector.
Ensure a Java runtime is installed on the collector host and the JMX gatherer JAR exists at the configured path, or no metrics will be produced.
Troubleshooting
No metrics appear
Symptoms: the source is configured but no JVM metrics arrive.
Solutions:
Confirm the target JVM was started with
-Dcom.sun.management.jmxremoteand a JMX port, and that Port matchescom.sun.management.jmxremote.port.Verify the JMX gatherer JAR exists at JMX Metrics Collection Jar Path and that a Java runtime is installed on the collector host.
Connection refused or timeout
Symptoms: the collector logs connection errors reaching the JMX endpoint.
Solutions:
Confirm the Address and Port are reachable from the collector host (firewalls, RMI port binding).
Remote JMX can negotiate a second RMI data port. Ensure any intermediate firewall allows the negotiated port, or pin it on the JVM side.
Authentication or TLS errors
Symptoms: the connection is reached but rejected, or a TLS handshake fails.
Solutions:
If the JVM requires authentication or TLS, the gatherer connection must present matching credentials and trust the JVM's certificate.
For testing only, confirm whether the JVM was started with
jmxremote.authenticate=falseandjmxremote.ssl=false.
Standalone Source
Related Resources
Last updated
Was this helpful?