Giter Site home page Giter Site logo

cloudflare / kafka_zookeeper_exporter Goto Github PK

View Code? Open in Web Editor NEW
72.0 24.0 14.0 1.15 MB

Prometheus exporter for Kafka cluster state stored in ZooKeeper

License: Apache License 2.0

Makefile 6.28% Go 91.42% Dockerfile 2.30%
kafka zookeeper prometheus prometheus-exporter exporter metrics

kafka_zookeeper_exporter's Introduction

Kafka ZooKeeper Exporter

A daemon that exposes Kafka cluster state stored in ZooKeeper.

Motivation

Metrics exported by kafka_zookeeper_exporter provide cluster level overview of the entire cluster and can be used along jmx_exporter which provides broker level data. jmx_exporter exports what each brokers believes to be true, but this information can be incorrect in case of a network partition or other split brain issues. ZooKeeper on the other hand is the source of truth for the entire cluster configuration and runtime status, so the metrics exported from it are the best representation of the entire cluster status.

Metrics

kafka_topic_partition_count

Number of partitions configured for given topic.

kafka_topic_partition_replica_count

Number of replicas configured for given partition.

kafka_topic_partition_leader

This metric will have value 1 for the replica that is currently the leader for given partition.

kafka_topic_partition_leader_is_preferred

Each Kafka partition have a list of replicas, the first replica is the preferred (default) leader. This metric will have value 1 if the current partition leader is the preferred one.

kafka_topic_partition_replica_in_sync

This metric will indicate whenever given replica is in sync with the partition leader.

kafka_broker_is_controller

This metric will have value 1 for the broker that is currently the cluster controller.

kafka_consumers_offsets

The last offset consumed for a given (consumer, topic, partition).

This will only show metrics for legacy consumers that still store their offsets in Zookeeper.

kafka_zookeeper_scrape_error

Will have value 1 if there was an error retrieving or processing any of the data for the current scrape. 0 otherwise.

Building

go get -u github.com/cloudflare/kafka_zookeeper_exporter
cd $GOPATH/src/github.com/cloudflare/kafka_zookeeper_exporter
make

Usage

Start the exporter

./kafka_zookeeper_exporter <flags>

To see the list of avaiable flags run

./kafka_zookeeper_exporter -h

Send a request to collect metrics

curl localhost:9381/kafka?zookeeper=10.0.0.1:2181&chroot=/kafka/cluster&topic=mytopic1,mytopic2&consumer=myconsumer1,myconsumer2

Where:

  • zookeeper - required, address of the ZooKeeper used for Kafka, can be multiple addresses separated by comma
  • chroot - path inside ZooKeeper where Kafka cluster data is stored. Has to be omitted if Kafka resides in the root of ZooKeeper.
  • topic - optional, list of topics to collect metrics for. If empty or missing then all topics will be collected.
  • consumer - optional, list of consumers to collect metrics for. If empty or missing then all consumers will be collected.

If both topic and consumer are non-empty, then metrics where both are relevant will only be collected if they match both.

Prometheus configuration

Example Prometheus scrape job configuration:

- job_name: kafka_zookeeper_exporter_mycluster
  static_configs:
    - targets:
      # hostname and port `kafka-zookeeper-exporter` is listening on
      - myserver:9381
  metrics_path: /kafka
  scheme: http
  params:
    zookeeper: ['zk1.example.com:2181,zk2.example.com:2181']
    chroot: ['/kafka/mycluster']

This example uses static_configs to configure scrape target. See Prometheus docs for other ways to configure it.

kafka_zookeeper_exporter's People

Contributors

bobrik avatar csnook avatar mssalnikov avatar prymitive avatar raphting avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kafka_zookeeper_exporter's Issues

Send kafka matrices to Prometheus

Hello all,

I have built the Kafka exporter using the steps mentioned in READ ME. I can see the matrices when I fire the curl command as per the instructions. But I want to pass these matrices to my Prometheus machine and Prometheus pulls the matrices from "localhost:9381/metrics". How can I get the metrics on this web address? Or is there any other way I can pass on this Kafka metrics to my Prometheus.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.