0
0
Kafkadevops~10 mins

Prometheus and Grafana integration in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to expose Kafka metrics for Prometheus scraping.

Kafka
metricsReporter = new [1]();
Drag options to blanks, or click blank then click option'
APrometheusReporter
BJmxReporter
CConsoleReporter
DSlf4jReporter
Attempts:
3 left
💡 Hint
Common Mistakes
Using JmxReporter which exposes JMX metrics but not Prometheus format.
Using ConsoleReporter which prints metrics to console only.
2fill in blank
medium

Complete the Prometheus scrape configuration to monitor Kafka metrics.

Kafka
- job_name: 'kafka'
  static_configs:
    - targets: ['[1]']
Drag options to blanks, or click blank then click option'
Alocalhost:7071
Blocalhost:9092
Clocalhost:8080
Dlocalhost:1234
Attempts:
3 left
💡 Hint
Common Mistakes
Using Kafka broker port 9092 which is for client connections, not metrics.
Using random ports like 8080 or 1234.
3fill in blank
hard

Fix the error in the Grafana data source URL for Prometheus.

Kafka
url = 'http://[1]/api/v1';
Drag options to blanks, or click blank then click option'
Alocalhost:9090
Bprometheus:8080
Cprometheus:9090
Dlocalhost:8081
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong port like 8080 or 8081.
Using localhost when Prometheus runs in a container named 'prometheus'.
4fill in blank
hard

Complete the code to create a Prometheus alert rule for Kafka consumer lag.

Kafka
alert: KafkaConsumerLagHigh
expr: kafka_consumer_lag > [1]
for: 5m
Drag options to blanks, or click blank then click option'
B1000
C100
Dsum
Attempts:
3 left
💡 Hint
Common Mistakes
Adding operators like 'sum' directly after metric name.
Using too low threshold like 100 which may cause false alerts.
5fill in blank
hard

Fill all three blanks to configure Kafka JMX exporter for Prometheus.

Kafka
jmx_prometheus_javaagent=[1]=[2]:[3]
Drag options to blanks, or click blank then click option'
Ajavaagent.jar
Blocalhost
C7071
Dkafka-jmx-exporter.jar
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic javaagent.jar instead of Kafka specific jar.
Wrong host or port for metrics endpoint.