Prometheus 監控Haproxy


Prometheus 監控Haproxy

普羅米修斯是一個完整的監控和趨勢系統,包括基於時間序列數據的內置和主動刮削,存儲,查詢,繪圖和警報,以下使用Prometheus+grafana對Haproxy進行監控,關於prometheus和Haproxy安裝不再贅述。

客戶端安裝

安裝Haproxy_exporter

https://github.com/prometheus/haproxy_exporter/releases/download/v0.9.0/haproxy_exporter-0.9.0.linux-386.tar.gz

tar xf haproxy_exporter-0.9.0.linux-386.tar.gz
cd haproxy_exporter-0.7.1.linux-amd64
cp haproxy_exporter /usr/bin
#192.168.1.1 本地服務器IP
#5000 Haproxy端口
#9100 監控端口
haproxy_exporter --haproxy.scrape-uri="http://192.168.1.1:5000/baz?stats;csv" --web.listen-address="192.168.1.1:9100" &

 

服務端安裝

Prometheus配置添加

find / -name prometheus.yml
vi /etc/prometheus.yml 
##新增
- job_name: haproxy
  scrape_interval: 1s
  scrape_timeout: 1s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - 192.168.1.1:9101
    labels:
      instance: haproxy:9101

 

導入haproxy_rev7.json文件

地址:https://grafana.com/api/dashboards/2428/revisions/7/download

 

grafana展示效果

 

 

 

參考來源:

https://blog.51cto.com/youerning/2050543

https://grafana.com/dashboards/367

https://grafana.com/dashboards/2428/revisions

https://blog.csdn.net/felix_yujing/article/details/75571073  Prometheus采集用的exporter

 


免責聲明!

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



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