Configure Kafka JMX exporter
Kafka exposes operational metrics through Java Management Extensions (JMX), which requires enabling JMX remote access on your Kafka brokers. JMX provides comprehensive visibility into broker performance, topic statistics, partition health, and other critical operational data that your monitoring tool can collect and forward to Grafana Cloud.
To configure JMX settings, you’ll set the JMX port and authentication options based on your security requirements. The configuration typically involves setting environment variables that the Kafka broker reads during startup to enable JMX remote access.
On your Kafka broker server, complete the following steps:
Locate the Kafka configuration directory (typically
/opt/kafka/configor/etc/kafka).Edit the
server.propertiesfile or create akafka-run-class.shoverride.Add or update the following JMX environment variables in your Kafka startup script or systemd service file:
export JMX_PORT=9999 export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9999"If running multiple brokers, ensure each broker uses a unique JMX port or IP binding.
Restart the Kafka broker service to apply the JMX configuration changes.
Verify the JMX port is accessible:
telnet localhost 9999.
The JMX port responds to connection attempts and you can access JMX metrics from the Kafka broker. Repeat these steps for all brokers in your cluster.
In the next milestone, you learn about the advantages of using Grafana Alloy for Kafka metrics collection.
More to explore (optional)
At this point in your journey, you can explore the following paths:
Troubleshooting
Explore the following troubleshooting topics if you need help:
Troubleshooting options
Please tell us what didn't work:
