prometheus应用之监控kafka集群

1 下载 kafka_exporter

https://github.com/danielqsj/kafka_exporter/releases/download/v1.3.1/kafka_exporter-1.3.1.linux-amd64.tar.gz
解压
tar -xf kafka_exporter-1.3.1.linux-amd64.tar.gz  -C /usr/local/
root@Thor01:/usr/local# ln -s kafka_exporter-1.3.1.linux-amd64 kafka_exporter

2 启动 kafka_exporter

root@Thor01:/usr/local/kafka_exporter# nohup  ./kafka_exporter --kafka.server=192.168.88.140:9093 &

3 配置prometheus

 - job_name: 'kafka'
    static_configs:
    - targets: ['192.168.88.140:9308'] 
      labels:
           project: kafka    

systemctl restart prometheus-server.service 
systemctl status prometheus-server.service

4 grafana配置kafka展示图

导入grafana官方监控图标7589
prometheus应用之监控kafka集群

5 自定义grafana图

5.1 生产环境的监控环境配置及对应查询语句

prometheus应用之监控kafka集群prometheus应用之监控kafka集群

5.2 监控kafka_broker

prometheus应用之监控kafka集群

5.3 监控所有topic实时生产速率

prometheus应用之监控kafka集群

语句:sum(irate(kafka_topic_partition_current_offset{topic !~ "__consumer_offsets|__transaction_state|test",env="env",app="app"}[30s])) by (topic) >= 0

5.4 groud_id消息积压情况

prometheus应用之监控kafka集群

语句:sum(kafka_consumergroup_lag{env="env",app="app"}) by (topic,consumergroup)

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: