Note: This document explains how to configure Apache Kafka monitoring through Prometheus integration in Applications Manager.
Monitoring Flow:
Kafka Broker
|
v
JMX Exporter (7071)
|
v
Prometheus Server (9090)
|
v
Applications Manager
Enable JMX while starting Kafka.
Example:
set JMX_PORT=1304
set KAFKA_OPTS=-Dcom.sun.management.jmxremote ^
-Dcom.sun.management.jmxremote.port=1304 ^
-Dcom.sun.management.jmxremote.rmi.port=1304 ^
-Dcom.sun.management.jmxremote.authenticate=false ^
-Dcom.sun.management.jmxremote.ssl=false ^
-Djava.rmi.server.hostname=<Kafka_Hostname> ^
-Dcom.sun.management.jmxremote.local.only=false
Start Kafka:
kafka-server-start.bat ..\..\config\server.properties
Verify JMX port:
netstat -ano | findstr 1304
Download the Prometheus JMX Exporter Java Agent JAR and place it in a directory such as:
C:\jmx
Create the configuration file:
C:\jmx\kafka.yml
Use the provided Kafka rules file (attached separately) which contains Kafka-specific metric mappings and naming conventions.
Add the following Java Agent configuration:
set KAFKA_OPTS=-javaagent:C:\jmx\jmx_prometheus_javaagent.jar=7071:C:\jmx\kafka.yml
Restart Kafka.
Open:
http://<KafkaHost>:7071/metrics
You should see Prometheus-formatted metrics beginning with:
# HELP
# TYPE
Download Prometheus Windows package from:
https://prometheus.io/download/
Extract to:
C:\prometheus
Edit:
C:\prometheus\prometheus.yml
Add Kafka scrape configuration:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'kafka'
static_configs:
- targets:
- '<KafkaHost>:7071'
prometheus.exe --config.file=prometheus.yml
Open:
http://<PrometheusHost>:9090
Navigate to:
Status → Targets
The Kafka target should appear as:
UP
Open:
http://<PrometheusHost>:9090/api/v1/query?query=up
A valid JSON response should be returned.
Navigate to:
New Monitor → Prometheus
Configure:
| Parameter | Value |
|---|---|
| Display Name | Kafka Prometheus |
| Host | <PrometheusHost> |
| Port | 9090 |
Important:
After configuring Prometheus integration:
Cause:
Applications Manager configured with port 7071.
Resolution:
Configure Applications Manager to connect to Prometheus on port 9090 instead of JMX Exporter.
Error:
FileNotFoundException: kafka.yml
Resolution:
| Validation | Status |
|---|---|
| Kafka Running | ✓ |
| JMX Enabled (1304) | ✓ |
| JMX Exporter Running (7071) | ✓ |
| Prometheus Running (9090) | ✓ |
| Prometheus Target UP | ✓ |