Monitoring HAProxy
原文:https://docs.gitlab.com/ee/user/project/integrations/prometheus_library/haproxy.html
- Requirements
- Metrics supported
- Configuring Prometheus to monitor for HAProxy metrics
- Specifying the Environment label
Monitoring HAProxy
在 GitLab 9.4 中引入
GitLab 支持自动检测和监视 HAProxy. 这是通过利用HAProxy Exporter来提供的,后者将 HAProxy 统计信息转换为 Prometheus 可读形式.
Requirements
必须启用Prometheus 服务 .
Metrics supported
Name | Query |
---|---|
吞吐量(要求/秒) | sum(rate(haproxy_frontend_http_requests_total{%{environment_filter}}[2m])) by (code) |
HTTP 错误率(%) | sum(rate(haproxy_frontend_http_requests_total{code="5xx",%{environment_filter}}[2m])) / sum(rate(haproxy_frontend_http_requests_total{%{environment_filter}}[2m])) |
Configuring Prometheus to monitor for HAProxy metrics
要开始使用 NGINX 监视,您应该安装并配置HAProxy 导出程序 ,该程序可以解析这些统计信息并将其转换为 Prometheus 监视端点.
Specifying the Environment label
为了隔离并仅显示给定环境的相关指标,GitLab 需要一种方法来检测关联了哪些标签. 为此,GitLab 将查找environment
标签 .