编程知识 cdmana.com

Prometheus monitoring traditional environmental monitoring (IV) Kafka monitoring

Monitoring components :kafka-exporter

github Address :GitHub - imduffy15/kafka_exporter: Kafka exporter for Prometheus

start-up :

docker run -d \
--restart=always \
--restart=on-failure:5 \
--name kafka_exporter \
-v /etc/localtime:/etc/localtime \
-p 9308:9308 \
danielqsj/kafka-exporter:v1.2.0 \
--kafka.server=172.30.0.11:9092

--kafka.server=172.30.0.11:9092 You can specify multiple kafka

--kafka.server=172.30.0.11:9092
--kafka.server=172.30.0.12:9092
--kafka.server=172.30.0.13:9092

Here is a demonstration of a single point of monitoring

prometheus Integrate kafka_exporter

vim prometheus.yml

# kafka  monitor 
  - job_name: 'kafka-172.30.0.11'
    scrape_interval: 10s
    static_configs:
      - targets: ['192.168.0.39:9308']
        labels:
          kafka_ip: 'kafka-172.30.0.11'

restart prometheus The container takes effect

grafana code :7589

https://grafana.com/grafana/dashboards/7589

Alarm rules :

# cat rules/kafka-export-alert-rules.yaml 


groups:
    - name: kafka Consumption lag alarm 
      rules:
      - alert: kafka Consumption lags behind 
        expr: sum(kafka_consumergroup_lag{topic!="sop_free_study_fix-student_wechat_detail"}) by (consumergroup, topic) > 1000
        for: 3m
        labels:
          serverity: warning
          status:  serious 
        annotations:
          summary: "kafka Consumption lags behind "
          description: "{
   {$.Labels.consumergroup}}##{
   {$.Labels.topic}}: Consumption lags behind 1000 continued 3 minute ( At present :{
   {$value}})"

      - alert: kafka-exporter down
        expr: kafka_exporter_build_info < 1
        for: 3m
        labels:
          serverity: warning
          status:  serious 
        annotations:
          summary: "kafka-exporter down"
          description: "kafka-exporter down {
   {$.Labels.instance}}"

      - alert: kafka server down
        expr: kafka_brokers < 1
        for: 3m
        labels:
          serverity: warning
          status:  serious 
        annotations:
          summary: "kafka server down"
          description: "kafka server down {
   {$.Labels.job}}"

 

Multi point monitoring reference article :

prometheus monitor kafka_ Scorpion blog -CSDN Blog _prometheus monitor kafka

版权声明
本文为[My meow is the sixth day of junior high school]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/134/202205141346414824.html

Scroll to Top