Prometheus監控kafka


一、在kafka服務器上安裝kafka_exporter

注:1個kafka集群只需要1個exporter,在集群上的任意1台服務器部署。

1、 下載包地址:https://github.com/danielqsj/kafka_exporter/releases/download/v1.2.0/kafka_exporter-1.2.0.linux-amd64.tar.gz

2、安裝kafka_exporter

# tar zxf  kafka_exporter-1.2.0.linux-amd64.tar.gz -C /usr/local/
# cd /usr/local/kafka_exporter-1.2.0.linux-amd64/

3、啟動kafka_exporter

 #  nohup ./kafka_exporter --kafka.server 172.16.68.169:9092 &

 

 4、瀏覽器輸入http://172.16.68.169:9308/metrics,可看到kafka_exporter抓取的監控指標。

 

 二、編輯prometheus配置文件

# cat prometheus.yml                      #在文檔末尾添加一下內容,注意格式
- job_name: 'kafka'                  
    static_configs:
    - targets: ['172.16.68.169:9308']    #配置kafka監控

配置文件語法檢測

# ./promtool check config prometheus.yml

Checking prometheus.yml SUCCESS:
2 rule files found Checking rules/kafka.yml SUCCESS: 1 rules found Checking rules/kafka_lag.yml SUCCESS: 1 rules found

重啟prometheus

# systemctl restart prometheus.service

三、打開瀏覽器輸入http://172.16.68.169:9090/

Status--->Targets,可看到kafka監控已經UP了。

 

 

 四、grafana導入引導盤

 

  • Grafana儀表盤參考:

  1. https://grafana.com/grafana/dashboards/7589 (推介)
  2. https://grafana.com/grafana/dashboards/9018 (參考-新的)
  3. https://grafana.com/grafana/dashboards/9947(參考-新的)
  4. https://grafana.com/grafana/dashboards/10973(JMX-阿里雲)
  5. https://www.menina.cn/article/88
  6. https://cloud.tencent.com/developer/news/377416


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM