Monitoring

Prerequisite

  • Stop all server in previous lab

    • type ctrl+c in each terminal (stop kafka before stop zookeeper)

    • check kafka broker and zookeeper process with jps command

      jps
  • clear old data in previous lab

    rm -rf /tmp/zookeep*
    rm -rf /tmp/kaf*

JMX Exporter

JMX Library

  • verify jmx libraries in /libs path such as jmx_prometheus_javaagent-xxxx.redhat-xxx.jar

    example result

JMX Zookeeper

  • create zookeeper prometheus config file such as zookeeper.yml and save file in ~/amq-streams-2022/4-management/kafka/config of zookeeper server node.

  • for zookeeper, edit ~/amq-streams-2022/4-management/kafka/bin/zookeeper-server-start.sh by add config to load jmxagent jar file and set configuration to file zookeeper.yml in previous step such as

  • start zookeeper

  • check port 7075 start with command, open new terminal

    example result

  • call curl to http://localhost:7075/metrics for check metrics work!

    example result

JMX Kafka

  • create kafka broker prometheus config file such as kafka_broker.yml and save file in /kafka/config of kafka broker node.

  • for kafka broker, edit ~/amq-streams-2022/4-management/kafka/bin/kafka-server-start.sh by add config to load jmxagent jar file and set configuration to file kafka_broker.yml in previous step such as

  • start kafka broker

  • check port 7076 start with command, open new terminal

    example result

  • call curl to http://localhost:7076/metrics for check metrics work!

    example result

Kafka Exporter

Prepare Topic Data

  • List the topics using Kafka, open new terminal and run command

  • no topic show in terminal

  • create sample new topic which we will use

    result of create topic command

  • List the topics again to see it was created.

  • Describe the topic to see more details:

  • start consumer, open new terminal and run command

  • Start the console producer for create and send message to topic

  • Wait until it is ready (it should show >). and send 3 messages.

  • stop consumer console by type ctrl+c

  • back to producer console and submit 3 more data

  • stop producer console

  • List the topics again to see '__consumer_offsets' was created.

    example result

  • monitor consumer groups:

  • and describe them: see current-offset, last-offset, lag

    example result

Run Kafka Exporter

  • run kafka exporter

    example result

  • call curl to http://localhost:9308/metrics for check metrics work!

    example result

Last updated