Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kafka_exporter

> 云原生
Open source

Kafka exporter for Prometheus

2.5K stars0 likes3 views
WebsiteGitHub

About

Kafka exporter for Prometheus

kafka_exporter

Kafka exporter for Prometheus. For other metrics from Kafka, have a look at the JMX exporter.

Table of Contents

  • Compatibility
  • Dependency
  • Download
  • Compile
    • Build Binary
    • Build Docker Image
  • Run
    • Run Binary
    • Run Docker Image
    • Run Docker Compose
  • Flags
    • Notes
  • Metrics
    • Brokers
    • Topics
    • Consumer Groups
  • Grafana Dashboard
  • Contribute
  • Donation
  • License

Compatibility

Support Apache Kafka version 0.10.1.0 (and later).

Dependency

  • Prometheus
  • Sarama
  • Golang

Download

Binary can be downloaded from Releases page.

Compile

Build Binary

bash
make

Build Docker Image

bash
make docker

Docker Hub Image

bash
docker pull danielqsj/kafka-exporter:latest

It can be used directly instead of having to build the image yourself. (Docker Hub danielqsj/kafka-exporter)

Run

Run Binary

bash
kafka_exporter --kafka.server=kafka:9092 [--kafka.server=another-server ...]

Run Docker Image

bash
docker run -ti --rm -p 9308:9308 danielqsj/kafka-exporter --kafka.server=kafka:9092 [--kafka.server=another-server ...]

Run Docker Compose

make a docker-compose.yml flie

services:
  kafka-exporter:
    image: danielqsj/kafka-exporter 
    command: ["--kafka.server=kafka:9092", "[--kafka.server=another-server ...]"]
    ports:
      - 9308:9308     

then run it

docker-compose up -d

Flags

This image is configurable using different flags

Flag name Default Description
kafka.server kafka:9092 Addresses (host:port) of Kafka server
kafka.version 2.0.0 Kafka broker version
sasl.enabled false Connect using SASL/PLAIN
sasl.handshake true Only set this to false if using a non-Kafka SASL proxy
sasl.username SASL user name
sasl.password SASL user password
sasl.mechanism plain SASL SCRAM SHA algorithm: sha256 or sha512 or SASL mechanism: gssapi, awsiam or oauthbearer
sasl.aws-region AWS_REGION env The AWS region for IAM SASL authentication
sasl.oauthbearer-token-url The url to retrieve OAuthBearer tokens from, for OAuthBearer SASL authentication
sasl.oauthbearer-token-file Path to a file containing an OAuthBearer token (e.g. a Kubernetes projected service account token). Re-read on each SASL handshake. Takes precedence over sasl.oauthbearer-token-url
sasl.oauthbearer-scopes The comma-separated scopes to use for OAuthBearer SASL authentication authentication
sasl.service-name Service name when using Kerberos Auth
sasl.kerberos-config-path Kerberos config path
sasl.realm Kerberos realm
sasl.keytab-path Kerberos keytab file path
sasl.kerberos-auth-type Kerberos auth type. Either 'keytabAuth' or 'userAuth'
tls.enabled false Connect to Kafka using TLS
tls.server-name Used to verify the hostname on the returned certificates unless tls.insecure-skip-tls-verify is given. The kafka server's name should be given
tls.ca-file The optional certificate authority file for Kafka TLS client authentication
tls.cert-file The optional certificate file for Kafka client authentication
tls.key-file The optional key file for Kafka client authentication
tls.insecure-skip-tls-verify false If true, the server's certificate will not be checked for validity
server.tls.enabled false Enable TLS for web server
server.tls.mutual-auth-enabled false Enable TLS client mutual authentication
server.tls.ca-file The certificate authority file for the web server
server.tls.cert-file The certificate file for the web server
server.tls.key-file The key file for the web server
topic.filter .* Regex that determines which topics to collect
topic.exclude ^$ Regex that determines which topics to exclude
group.filter .* Regex that determines which consumer groups to collect
group.exclude ^$ Regex that determines which consumer groups to exclude
web.listen-address :9308 Address to listen on for web interface and telemetry
web.telemetry-path /metrics Path under which to expose metrics
log.enable-sarama false Turn on Sarama logging
use.consumelag.zookeeper false if you need to use a group from zookeeper
zookeeper.server localhost:2181 Address (hosts) of zookeeper server
kafka.labels Kafka cluster name
refresh.metadata 30s Metadata refresh interval
offset.show-all true Whether show the offset/lag for all consumer group, otherwise, only show connected consumer groups
concurrent.enable false If true, all scrapes will trigger kafka operations otherwise, they will share results. WARN: This should be disabled on large clusters
topic.workers 100 Number of topic workers
verbosity 0 Verbosity log level

Notes

Boolean values are uniquely managed by Kingpin. Each boolean flag will have a negative complement: --<name> and --no-<name>.

For example:

If you need to disable sasl.handshake, you could add flag --no-sasl.handshake

Metrics

Documents about exposed Prometheus metrics.

For details on the underlying metrics please see Apache Kafka.

Brokers

Metrics details

Name Exposed informations
kafka_brokers Number of Brokers in the Kafka Cluster
kafka_broker_info Information about the Kafka Broker

Metrics output example

txt
# HELP kafka_brokers Number of Brokers in the Kafka Clu

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gokafkakafka-metricsmetricsprometheus

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category云原生
PricingOpen source

> Related tools

K
Kubernetes
容器编排事实标准
H
Helm
Kubernetes 包管理器
S
seaweedfs
SeaweedFS is a distributed storage system for object storage (S3), file systems, and Iceberg tables,