- Track cluster health: brokers, topics, partitions, and offline or under-replicated partitions.
- Measure topic throughput as the number of messages written in each interval.
- Watch consumer group lag per topic and per partition, so you know when a consumer falls behind.
- See each consumer group’s state (Stable, Empty, Rebalancing, and so on) and its number of members.
- Collect Kafka broker logs.
Setup
No additional installation is required. The Kafka integration is bundled with the Atatus Infrastructure Agent. The agent only reads cluster metadata, offsets, and consumer group details. It never produces or consumes messages.Permissions for clusters with ACLs
If your cluster uses ACLs, give the agent’s userDescribe permission on the cluster, on the topics, and on the consumer groups you want to monitor. These permissions are read-only. The examples use a user named atatus:
'*' with specific topic or group names to limit what the agent can see. Topics and groups the agent cannot describe are left out of the metrics.
Configuration
Metrics
Copy the Kafka example configuration file that ships with the agent:/etc/atatus-infra-agent/conf.d/kafka.d/kafka.yml. Each entry monitors one Kafka cluster:
hostslists one or more bootstrap brokers of the cluster. The agent discovers the other brokers from them and reports the cluster once, however many brokers you list.cluster_nameis added to every metric as thekafka_clusterattribute. Set it when you monitor more than one cluster.periodis how often the agent collects metrics. The default is30s.
Brokers reply with their advertised listener (
advertised.listeners in the broker config), and the agent uses that address for every connection after the first one. That address must resolve and be reachable from the agent host. A broker running in Docker that advertises its container name, for example kafka:9092, needs a matching /etc/hosts entry on the agent host.Authentication and TLS
For a cluster that uses SASL or TLS listeners, add the credentials and TLS settings to the same entry:usernameandpasswordare the SASL credentials. Leave both out for a PLAINTEXT listener.kafka_options.sasl_mechanismisPLAIN,SCRAM-SHA-256, orSCRAM-SHA-512. It defaults toPLAINwhen a username is set.tls.verification_modeisfull,certificate, ornone. Usenoneonly for test brokers with self-signed certificates.
Filter topics and consumer groups
By default the agent reports every topic (except Kafka’s internal topics such as__consumer_offsets) and every consumer group. Use kafka_options to narrow this down:
Logs
Logs are configured in the same file as metrics. First, turn on log collection for the agent in/etc/atatus-infra-agent/atatus.yml:
logs section to /etc/atatus-infra-agent/conf.d/kafka.d/kafka.yml, pointing at your broker log files:
Verify Metrics
You can check that the brokers are reachable from the agent host with the tools that ship with Kafka:--command-config with a client properties file that holds the same credentials as kafka.yml.
Restart the Agent
After configuration, restart the Atatus Infrastructure Agent:Metrics
These are the metrics the integration collects from Kafka. Every metric also carries thehost attribute, and kafka_cluster when cluster_name is set.
Troubleshooting
If no Kafka metrics appear, check the agent log at/var/log/atatus-infra-agent/agent.log for lines that start with kafka integration:
the broker advertises <address>; that address must resolve and be reachable from this host: the first broker answered, but its advertised listener cannot be reached from the agent host. Fixadvertised.listenerson the broker, or make the address resolve on the agent host (for example with an/etc/hostsentry).kafka_options.sasl_mechanism ... is not supported: setsasl_mechanismtoPLAIN,SCRAM-SHA-256, orSCRAM-SHA-512.password must be set when username is configured: add the SASL password, or removeusernamefor a PLAINTEXT listener.per-partition series over max_partition_contexts ... were not sent: the cluster has more partitions thanmax_partition_contexts. Totals are still complete. Raise the limit, or narrowtopicsandconsumer_groups, to get every partition.- Lag is missing for a consumer group: the group has not committed offsets for that topic yet, or the agent’s user lacks
Describepermission on the group or the topic.