Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable remote JMX on Kafka brokers (for JmxTool)?

I enabled JMX on Kafka brokers by adding

KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true                 -Dcom.sun.management.jmxremote.authenticate=false                 -Dcom.sun.management.jmxremote.ssl=false                 -Djava.rmi.server.hostname=<server_IP>                 -Djava.net.preferIPv4Stack=true" 

However, when I use kafka.tools.JmxTool to get the JMX metrics, it outputs Unix timestamps only. Why?

./bin/kafka-run-class.sh kafka.tools.JmxTool \   --object-name 'kafka.server:type=BrokerTopicMetrics,name=AllTopicsMessagesInPerSec' \   --jmx-url "service:jmx:rmi:///jndi/rmi://<server_IP>:9111/jmxrmi" 

How can I have it print out the metrics?

like image 442
sui Avatar asked Apr 19 '16 04:04

sui


People also ask

How do I enable JConsole for remote monitoring?

In your JConsole, select Remote Process and connect to the server and port that you've specified in your artifactory. default (or default) file. Authenticate this with the username/password specified in your jmxremote.


1 Answers

Edit bin/kafka-run-class.sh and set KAFKA_JMX_OPTS variable

KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=your.kafka.broker.hostname -Djava.net.preferIPv4Stack=true" 

Update bin/kafka-server-start.sh add the below line

export JMX_PORT=PORT 
like image 132
chandramohan Avatar answered Sep 27 '22 23:09

chandramohan