Code Monkey home page Code Monkey logo

kafka-prometheus-monitoring's Introduction

kafka-prometheus-monitoring

Dockerised example of monitoring Apache Kafka with Prometheus and Grafana. This project makes use of the prometheus-jmx-exporter which is configured to extract metrics from Kafka's JMX server. These metrics are then exposed via HTTP GET and polled by Prometheus.

Pre-Requisites

  • install Docker and Docker Compose - https://docs.docker.com/
  • set KAFKA_ADVERTISED_HOST_NAME in docker-compose.yml to match your docker host IP. (Note: Do not use localhost or 127.0.0.1 as the host ip if you want to run multiple brokers). See wurstmeister's docker-kafka for more information on configuring Kafka - https://github.com/wurstmeister/kafka-docker

Usage

docker-compose up
  • View Prometheus UI - http://$DOCKER_HOST_IP:9090
  • Grafana UI - http://$DOCKER_HOST_IP:3000 (admin:admin)
  • Kafka metrics - http://$DOCKER_HOST_IP:8080/metrics

Sending Kafka messages

In order for the Kafka broker to expose JMX topic metrics you must send some messages to the topics.

cat kafka-messages | docker run -i -a stdin wurstmeister/kafka /opt/kafka_2.11-0.10.0.1/bin/kafka-console-producer.sh --broker-list $DOCKER_HOST_IP:9092 --topic customer
cat kafka-messages | docker run -i -a stdin wurstmeister/kafka /opt/kafka_2.11-0.10.0.1/bin/kafka-console-producer.sh --broker-list $DOCKER_HOST_IP:9092 --topic audit

Viewing Prometheus Metrics

The kafka metrics are pulled into Prometheus via the JMX exporter. These can be viewed in Prometheus by navigating to http://$DOCKER_HOST_IP:9090/graph, enter a metric name to view the graphs.

Prometheus UI

Viewing Graphs in Grafana

Grafana can be used to build a more meaningful dashboard of the metrics in Prometheus, navigate to Grafana on http://$DOCKER_HOST_IP:3000 (admin:admin). An example dashboard is available to import in dashboards/Kafka.json.

Grafana Kafka Dashboard

kafka-prometheus-monitoring's People

Contributors

rama-nallamilli avatar siweiwang avatar

Watchers

James Cloos avatar

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.