Kafka Connect: JMX JConsole (Docker)
Yes, you absolutely can connect JConsole to Kafka Connect and extract JMX metrics. If you are experiencing problems getting it to work this blog post will get you through it. There are 2 “gotcha’s” with getting this to work with Docker/Docker Compose. The
KAFKA_JMX_HOSTNAME variable must be set and the correct Java JDK must be used. Recently, there was a pull request to include the
KAFKA_JMX_HOSTNAME variable in the Docker Compose. I had issues with this because it wasn’t very clear. The other issue I experienced was an incompatibility issue with JConsole.
Docker Environmental Variables
Docker Compose Example
Digging through the Confluent Kafka Docker Images
In general, there are settings that are set in Java to allow for JMX metrics. I recommend reading this blog post to become more familiar. I found Piotr Filipowicz’s post (How to configure JMX in Spring Boot inside Docker?) very useful in understanding this process.
JConsole Failing (Disconnecting)
This is a common problem that can exist for one of two reasons.
Opening JConsole in Debug Mode
JDK Version Compatibility Issues
These articles helped me.