Search code examples
apache-kafkajmx

Gathering `kafka.producer` metrics using JMX


I have a Kakfa broker running, which I am monitoring with JMX.

This broker is a docker container running as a process started with kafka-server-start.sh JMX port 9999 is exposed as and used as an environment variables.

When I connect to the JMX port and try to list all the domains, I get the following;

kafka
kafka.cluster
kafka.controller
kafka.coordinator.group
kafka.coordinator.transaction
kafka.log
kafka.network
kafka.server
kafka.utils

I dont see kafka.producer which is understandable because the producer for this Kafka broker are N numbers of different applications, but at this point I am confused.

How do I get the kafka.producer metrics as well. Do I have to expose the kafka.producer metrics in each of N application that is acting as producer OR is there some configuration that start gathering kafka.producer metrics on the broker only.

What is the correct way of doing this. Please help.


Solution

  • Yes you are correct , to capture the producer JMX metrics , you need to enable JMX in all the processes which are running the kafka producer instance.