Quick revision
The short answer
The first alerts are the ones that mean clients are failing now: OfflinePartitionsCount above 0, UnderMinIsrPartitionCount above 0, and the sum of ActiveControllerCount across controllers not equal to 1, plus OfflineLogDirectoryCount above 0; these page at once. UnderReplicatedPartitions above 0 for several minutes, request and network thread idle below about 0.3, rising p99 produce and fetch times and filling disks come next as tickets or pages depending on duration, all exported through the Prometheus JMX exporter and paired with client-side alerts.
What to remember
In this answer, we saw that the first alerts are those that mean clients fail now: offline partitions, partitions under min.insync.replicas, a controller quorum without exactly one active controller, and a failed log directory. Under-replication is alerted on duration, and thread idle ratios, p99 request times and disk use warn us before capacity runs out. We collect them with the Prometheus JMX exporter and add client-side alerts so we also catch failures that broker metrics miss.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The first alerts are the ones that mean clients are failing now: OfflinePartitionsCount above 0, UnderMinIsrPartitionCount above 0, and the sum of ActiveControllerCount across controllers not equal to 1, plus OfflineLogDirectoryCount above 0; these page at once. UnderReplicatedPartitions above 0 for several minutes, request and network thread idle below about 0.3, rising p99 produce and fetch times and filling disks come next as tickets or pages depending on duration, all exported through the Prometheus JMX exporter and paired with client-side alerts.
Why this question is asked
A Kafka cluster without alerting tends to announce its problems through the application teams: orders stop, a dashboard freezes, someone opens an incident. When we take over on-call, the first job is to make the cluster tell us before they do. Kafka exposes hundreds of metrics through JMX, and an interviewer wants to see whether we know the handful that matter and what each one means for clients. In this answer, we will recap the terms these metrics use, go through the alerts that should page immediately, look at under-replication, check the KRaft controller quorum, add saturation and storage alerts, and finally see how to get the metrics into Prometheus.
1A Quick Recap: Leaders, Followers and the ISR
Each partition has one leader replica, which serves all reads and writes, and follower replicas that copy the leader. The followers that are fully caught up form the in-sync replica set, the ISR. If the leader fails, the controller picks a new leader from the ISR.
Producers with acks=all wait until every replica in the ISR has the record. The topic setting min.insync.replicas, usually 2 with replication factor 3, says how small the ISR may become before such writes are refused. In Kafka 4.x the controllers are KRaft controllers: a small group of nodes, usually three, that keep the cluster metadata in a replicated log and elect one active controller to make decisions. With those terms, the metrics read almost like sentences.
2The Alerts That Page at Once
OfflinePartitionsCount, reported by the active controller under kafka.controller:type=KafkaController, counts partitions that have no leader. Such a partition can be neither written nor read, so any value above 0 is a client outage and pages immediately.
UnderMinIsrPartitionCount, under kafka.server:type=ReplicaManager on each broker, counts partitions whose ISR has fallen below min.insync.replicas. The partition still has a leader, so consumers keep reading, but producers using acks=all receive NotEnoughReplicasException and cannot write. Above 0 also pages, because writes are failing right now.
| Metric | Meaning | Action |
|---|---|---|
OfflinePartitionsCount > 0 | Partitions without a leader | Page at once |
UnderMinIsrPartitionCount > 0 | acks=all writes fail | Page at once |
Sum of ActiveControllerCount != 1 | No active controller, metadata stuck | Page at once |
OfflineLogDirectoryCount > 0 | A data disk failed on a broker | Page |
UnderReplicatedPartitions > 0 | A replica is down or behind | Ticket; page if it lasts |
Thread idle < 0.3, p99 TotalTimeMs up | Broker saturated | Ticket or page by trend |
| Disk use per log directory | Retention will not fit | Ticket at 70%, page at 85% |
Notice the pattern: these are causes that map directly to a symptom a client feels. That is what makes them good paging alerts. Something that only might hurt later belongs in a ticket.
3Under-Replication: Ticket or Page?
UnderReplicatedPartitions, also under kafka.server:type=ReplicaManager, counts partitions led by this broker where at least one follower is not in the ISR. It is very common for it to blip above 0 for a few seconds during a rolling restart or a short network hiccup, so alerting on any non-zero value creates noise and teaches people to ignore the page.
So we alert on duration: above 0 for more than about five minutes opens a ticket, and above 0 for longer, or on many partitions, or together with UnderMinIsr, pages. The meaning is that a broker is down or a follower cannot keep up, and the cluster has lost some of its safety margin. One more failure on the same partitions would turn under-replication into under-min-ISR or offline partitions.
4Checking the KRaft Controller Quorum
ActiveControllerCount is 1 on the active controller and 0 on the others. The useful alert is therefore on the sum across all controllers: it must be exactly 1. Zero means there is no active controller, so no leader elections, topic changes or broker registrations can happen; existing leaders keep serving, which is why this can go unnoticed until something else fails. More than 1 for longer than a moment points to a split view of the quorum.
Beyond that single number, the quorum itself has a health check we can run from any machine with admin access.
We also watch the raft metrics the controllers expose, such as commit latency of the metadata log, and the metadata lag on brokers. Rising commit latency means metadata changes are slowing down, which shows up as slow topic creation and slow failovers. Exact metric names differ a little between versions, so check your version's monitoring documentation for the KRaft and raft-metrics groups.
5Saturation and Storage
The next group tells us a broker is running out of capacity before clients fail. RequestHandlerAvgIdlePercent (kafka.server:type=KafkaRequestHandlerPool) is the share of time the request handler threads are idle, and NetworkProcessorAvgIdlePercent (kafka.network:type=SocketServer) is the same for network threads. Both are fractions between 0 and 1. When they fall below about 0.3, the broker is busy most of the time and latency starts to climb, so a sustained drop is a ticket and a steep one is a page.
Latency itself comes from kafka.network:type=RequestMetrics,name=TotalTimeMs with request=Produce or request=FetchConsumer. We alert on the 99th percentile, because averages hide the slow requests that time out clients. For storage, we watch disk use per log directory from host metrics and OfflineLogDirectoryCount (kafka.log:type=LogManager), which becomes 1 when a disk fails and the broker stops using that directory. A failed disk always pages, because some partitions just lost a replica.
6Getting the Metrics Out and Alerting on Them
Kafka publishes metrics through JMX. The usual way to collect them is the Prometheus JMX exporter, run as a Java agent inside each broker and controller, with a rules file that turns MBean names into Prometheus metric names. A metrics reporter plugin is the alternative. The exact Prometheus names depend on the rules we write, so the expressions below are an example of the idea, not standard names.
Finally, we alert on what clients feel as well as on these causes: producer error rate and send latency, and consumer lag for important groups. Cause alerts tell us why; symptom alerts catch the failures our cause list did not foresee, such as an expired certificate that stops new connections while every broker metric looks healthy.
7Follow-up questions
Why not page on UnderReplicatedPartitions above 0?
Because it goes above 0 during every rolling restart and every short network blip, and the cluster still serves clients normally. Paging on it trains people to ignore pages. Alerting on duration, and paging when it combines with UnderMinIsr or offline partitions, keeps pages meaningful.
Where do we read OfflinePartitionsCount in KRaft mode?
From the active controller, under kafka.controller:type=KafkaController. The inactive controllers report 0, so we sum or take the maximum across all controller nodes rather than reading one node.
What is a healthy value for the thread idle ratios?
Above roughly 0.3, and ideally well above it at normal load. They are fractions, so 0.3 means the threads are idle 30 percent of the time. A steady decline over weeks is a capacity signal; a sudden drop usually means a client changed behaviour, such as very small batches or a burst of requests.
8Conclusion
In this answer, we saw that the first alerts are those that mean clients fail now: offline partitions, partitions under min.insync.replicas, a controller quorum without exactly one active controller, and a failed log directory. Under-replication is alerted on duration, and thread idle ratios, p99 request times and disk use warn us before capacity runs out. We collect them with the Prometheus JMX exporter and add client-side alerts so we also catch failures that broker metrics miss.
Open with
I would start with the alerts that mean clients are broken right now. OfflinePartitionsCount above zero on the active controller means partitions have no leader and cannot be read or written, so it pages immediately.
Then, if they want more
UnderMinIsrPartitionCount above zero means the ISR has dropped below min.insync.replicas, so acks=all producers get NotEnoughReplicas, and that pages too. For KRaft, I sum ActiveControllerCount across the controllers; it must be exactly one, because with zero no metadata changes or leader elections can happen. I would also check the quorum with kafka-metadata-quorum.sh describe status and replication and watch raft commit latency.
OfflineLogDirectoryCount above zero means a disk failed, which pages. UnderReplicatedPartitions is noisier, since it blips during restarts, so I alert on it after about five minutes as a ticket and page if it lasts or combines with under-min-ISR.
Then saturation: request handler and network processor idle ratios dropping below about 0.3, p99 TotalTimeMs for produce and fetch, and disk use per log directory, ticket at 70 percent and page at 85.
I would export everything with the Prometheus JMX exporter, and I would also alert on what clients feel, error rates, latency and lag, because some failures like an expired certificate never show in broker metrics.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Name the broker and controller metrics you would alert on first, what each one means...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/c38086b849/