Wednesday, September 27, 2017

Enabling the JMX PORT in kafka

If you want to get the metrics for the monitoring of the kafka than you need to enable the JMX port for the kafka which is 9999 be default.

You need to configure this port in the kafka/bin/kafka-server-start.sh by exporting the JMX_PORT which can be used to get the metrics for the kafka. The same port is also used by the datadog agent for providing the metrices of the kafka cluster.

Just enter the following line in the kafka-server-start.sh

 export JMX_PORT=${JMX_PORT:-9999}  
  exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"

Afterwards you will need to restart the kafka broker service to make this active.

Verify if the service is listening on the port 9999

# telnet localhost 9999
Connected to localhost.
Escape character is '^]'.

# netstat -tunlp | grep 9999
tcp        0      0  *               LISTEN      20031/java

This confirms the jmx port was successfully configured.


Post a Comment