Configuring JVM Monitoring for Windows 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\windows\kafka-run-class.bat file) and then check whether/not the JMX port is configured (see Figure 1).

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

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

set JMX_PORT=9990
rem JMX settings
IF ["%KAFKA_JMX_OPTS%"] EQU [""] (
set KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
)
rem JMX port to use
IF ["%JMX_PORT%"] NEQ [""] (
set KAFKA_JMX_OPTS=%KAFKA_JMX_OPTS% -Dcom.sun.management.jmxremote.port=%JMX_PORT%
)

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

installation location\bin\windows\zookeeper-server-start.bat config\zookeeper.properties

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

installation location\bin\windows\kafka-server-start.bat config\server.properties