作者:手机用户2502871605 | 来源:互联网 | 2023-01-17 16:55
haproxyprometheus的监控metrics使用的是exporter,因为haproxy对于状态统计报告处理的比较好,我们可以了stats同时支持一个csv的api接口,
haproxy prometheus 的监控metrics 使用的是exporter ,因为haproxy 对于状态统计报告处理的
比较好,我们可以了stats 同时支持一个csv的api 接口,所以exporter也是基于这个搞的开发,同时
里面对于不同版本的haproxy 做了适配
环境准备
- haproxy 配置文件
conf/haproxy/haproxy.cfg 很简单就是配置了stats 同时配置了一个简单的jenkins 的proxy+ lb
- exporter 配置
主要是启动的时候指定haproxy server 的地址,因为使用了basic auth, exporter 比较方便支持basic auth 格式的url
- prometheus 配置
实际上就是通过静态配置添加experter 地址 ./conf/prometheus.yml
运行&&效果
说明
docker-compose文件同时集成了grafana,可以方便的进行UI的可视化展示
参考资料
https://github.com/rongfengliang/haproxy_promethues-docker-compose
https://github.com/prometheus/haproxy_exporter
https://hub.docker.com/_/haproxy