Configuring JVM Monitoring for Linux in Apache Kafka Message System

To collect JVM-related metrics, the eG agent connects to the Apache Kafka Message System via JMX. By default, JMX support is not enabled on Apache Kafka Message System. However, to enable the eG agent to use JMX, the JVM tests that the eG agent runs should be configured with a JMX Remote Port - this is the port at which the JMX listens for requests from remote hosts. You need to determine the correct JMX remote port to configure.

Determining the JMX Remote Port

JMX can be configured based on the availability of the port. For our assumption, the JMX is configured in port 9990. To enable JVM metrics for Apache Kafka Message System component, first we need to specify the binary file location(for example:installation location/bin/ kafka-run-class.sh file and then check whether/not the JMX port is configured (see Figure 1).

Figure 1 : Determining the JMX Remote Port for Linux in Apache Kafka Message System

By default, the command export JMX_PORT=9990 will exist (see Figure 1). If not add the comment as:

export JMX_PORT=9990
# JMX settings
if [ -z "$KAFKA_JMX_OPTS" ]; then
KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false "
fi
# JMX port to use
if [ $JMX_PORT ]; then
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "
fi

Then start the zookeeper first, by the adding the command as

installation location/bin/zookeeper-server-start.sh config/zookeeper.properties

Finally, start the Kafka server by the adding the command as

installation location/bin/kafka-server-start.sh config/server.properties