Bird
Raised Fist0

You want to alert when Kafka broker CPU usage exceeds 80% for 5 minutes. Which Prometheus alert rule is correct?

hard🚀 Application Q9 of Q15
Kafka - Monitoring and Operations
You want to alert when Kafka broker CPU usage exceeds 80% for 5 minutes. Which Prometheus alert rule is correct?
Aalert: HighKafkaCPU expr: avg(rate(process_cpu_seconds_total[5m])) by (instance) > 0.8 for: 5m
Balert: HighKafkaCPU expr: avg(process_cpu_seconds_total) by (instance) > 80 for: 5m
Calert: HighKafkaCPU expr: max(rate(process_cpu_seconds_total[1m])) by (instance) > 0.8 for: 1m
Dalert: HighKafkaCPU expr: sum(process_cpu_seconds_total) > 80 for: 5m
Step-by-Step Solution
Solution:
  1. Step 1: Understand CPU usage metric

    process_cpu_seconds_total is a counter of CPU seconds used.
  2. Step 2: Use rate() to get CPU usage per second over 5 minutes

    rate(process_cpu_seconds_total[5m]) gives CPU usage rate.
  3. Step 3: Alert if average CPU usage per instance exceeds 0.8 (80%) for 5 minutes

    alert: HighKafkaCPU expr: avg(rate(process_cpu_seconds_total[5m])) by (instance) > 0.8 for: 5m matches this logic correctly.
  4. Final Answer:

    avg(rate(process_cpu_seconds_total[5m])) by (instance) > 0.8 for: 5m -> Option A
  5. Quick Check:

    Use rate() and avg() over 5m for CPU alert [OK]
Quick Trick: Use rate() on CPU counter and avg() over 5m [OK]
Common Mistakes:
MISTAKES
  • Using raw counter without rate()
  • Wrong threshold units (80 vs 0.8)
  • Shorter time windows than required

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes