Shubham Rath
Shubham Rath

Reputation: 68

How to access Kafka consumer metrics (consumer-fetch-manager-metrics) using JmxTool?

I use kafka_2.12-2.1.0.

The command I'm using:

bin/kafka-run-class.sh kafka.tools.JmxTool \
  --object-name 'kafka.consumer:type=consumer-fetch-manager-metrics,client-id=([-.\w]+)'
  --jmx-url service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi

The error I'm getting:

Trying to connect to JMX url: service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi.
No matched attributes for the queried objects ArrayBuffer(kafka.consumer:type=consumer-fetch-manager-metrics,client-id=([-.w]+)).

I am able to get other metrics except this consumer lag.

Upvotes: 1

Views: 965

Answers (1)

Jacek Laskowski
Jacek Laskowski

Reputation: 74779

service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi is the default remote JMX URL and could simply point to a Kafka broker not a Kafka consumer.

In other words, make sure you use a proper --jmx-url URL to connect to the Kafka consumer.

Use jps or jcmd command-line tools to know the proper value.

Upvotes: 1

Related Questions