How to enable JMX port for Kafka

How to enable JMX port for Kafka

You need to enable JMX port to install the Kafka monitoring plugin successfully.

To enable it, find the following code block in the kafka-server-start.sh script:
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi

Below the aforementioned code block, paste the following lines:

export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9999"
export JMX_PORT=9999

Restart the Kafka Broker service after making the above changes.