This episode covers alerting and health checks for Kafka: broker liveness check strategies, cluster health metrics, critical alerts like under-replicated partitions, controller flapping, and lag spikes, and integration into PagerDuty, Slack, and custom webhooks.

Monitoring gives you data; alerting turns data into action. Without good alerts, metrics just pile up on dashboards — real problems are only detected when users report them. Episode 23 covers how to build an effective alerting system for Kafka: health checks, critical alerts, and integration with notification channels.
The key to good alerting isn't quantity, but selectivity. Alerts should signal something that genuinely requires action, avoid alert fatigue, and provide enough context for a fast response.
The basic check: is the broker responding? Use the CLI to test the connection and API:
bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092 --version-checkkafka-broker-api-versions.sh --version-check confirms the broker responds with its API versions. For periodic checks, run this command on a cron schedule and alert if it fails — it verifies TCP connectivity, the protocol, and handlers all at once.
Beyond per-broker liveness, monitor aggregate health:
acks=all doesn't fail.Recommended thresholds:
A common Prometheus rule:
- alert: KafkaUnderReplicatedPartitions
expr: kafka_server_replicamanager_underreplicatedpartitions > 0
for: 5m
- alert: KafkaOfflinePartitions
expr: kafka_controller_kafkacontroller_offlinepartitionscount > 0
for: 1mfor: 5m gives transition tolerance so alerts don't flood during normal rebalance. These rules only fire when the condition persists past the duration.
For critical events, on-call integration: Prometheus Alertmanager sends alerts to PagerDuty or OpsGenie, which escalate to the on-call team. Set clear severities: critical (pages on-call) versus warning (email/Slack), so only real problems wake people up.
Non-critical channels or aggregate notifications go to Slack:
receivers:
- name: "slack-ops"
slack_configs:
- channel: "#kafka-alerts"
send_resolved: trueslack_configs routes notifications to a specific channel with send_resolved: true so teams know the problem is resolved. Include alert context — which broker, what metric, since when — in the message.
For special needs, Alertmanager can call a custom webhook. This opens up remediation automation: a webhook triggers a script that investigates the troubled broker, collects a thread dump, or executes standard repair actions. Start with safe automated investigation, then expand to remediation once the action is proven reliable.
Tip
Every alert must have a runbook: an explanation of what it means, how to investigate, and mitigation steps. An alert without a runbook is just noise. Create runbooks for all critical alerts before enabling them.
In this episode 23 you've understood broker and cluster health check strategies, critical alerts for under-replicated partitions, offline partitions, controller flapping, and lag spikes, and alert integration into PagerDuty, Slack, and custom webhooks.
The key takeaways:
for duration to avoid alert fatigue during normal rebalance.In the next episode 24 we'll dissect replication and high availability — leader and follower replicas, In-Sync Replicas, the high watermark, unclean leader election, min.insync.replicas, and rack awareness for failure domain isolation.