HAProxy
Bleemeo monitors HAProxy through its stats page (all versions) or its native Prometheus endpoint (2.0+).
Auto-Detection
Section titled “Auto-Detection”Glouton automatically detects HAProxy instances running on the system.
Built-in Metrics
Section titled “Built-in Metrics”Built-in metrics are gathered from the HAProxy CSV stats page. You need to enable the stats page and tell Glouton where to find it.
Service Configuration
Section titled “Service Configuration”Add a statistics endpoint to your HAProxy configuration:
frontend api-http bind 0.0.0.0:80 stats enable stats uri /statisticsGlouton Configuration
Section titled “Glouton Configuration”sudo tee /etc/glouton/conf.d/99-haproxy.conf > /dev/null << 'EOF'service: - type: "haproxy" address: "127.0.0.1" port: 80 stats_url: "http://my-server/statistics" # For authenticated access, use: # stats_url: "http://username:password@my-server/statistics"EOFCreate or edit the file C:\ProgramData\glouton\conf.d\99-haproxy.conf:
service: - type: "haproxy" address: "127.0.0.1" port: 80 stats_url: "http://my-server/statistics" # For authenticated access, use: # stats_url: "http://username:password@my-server/statistics"Glouton automatically detects configuration changes.
| Metric | Description |
|---|---|
service_status | Status of HAProxy |
haproxy_act | Number of active servers |
haproxy_bin | Network traffic received from clients in bytes per second |
haproxy_bout | Network traffic sent to clients in bytes per second |
haproxy_ctime | Average time spent opening a connection in seconds |
haproxy_dreq | Number of requests denied by HAProxy per second |
haproxy_dresp | Number of responses denied by HAProxy per second |
haproxy_econ | Number of failed connections per second |
haproxy_ereq | Number of requests in error per second |
haproxy_eresp | Number of responses in error per second |
haproxy_qcur | Number of currently queued requests |
haproxy_qtime | Average time a request spent in queue in seconds |
haproxy_req_tot | Number of HTTP requests per second |
haproxy_rtime | Average response time in seconds |
haproxy_scur | Number of sessions opened |
haproxy_stot | Number of sessions per second |
haproxy_ttime | Average session time in seconds |
Prometheus Metrics
Section titled “Prometheus Metrics”Since version 2.0, HAProxy exposes a native Prometheus endpoint that Glouton can scrape directly. This provides more detailed metrics than the stats page approach.
Service Configuration
Section titled “Service Configuration”Add a dedicated frontend to your HAProxy configuration (/etc/haproxy/haproxy.cfg):
frontend prometheus bind *:8405 http-request use-service prometheus-exporter if { path /metrics } no logReload HAProxy to apply the change:
sudo systemctl reload haproxyYou can verify the endpoint is working by visiting http://localhost:8405/metrics.
Glouton Configuration
Section titled “Glouton Configuration”sudo tee /etc/glouton/conf.d/99-haproxy.conf > /dev/null << 'EOF'metric: prometheus: targets: - url: "http://localhost:8405/metrics" name: "haproxy" allow_metrics: - "haproxy_process_current_connections" - "haproxy_process_uptime_seconds" - "haproxy_frontend_bytes_in_total" - "haproxy_frontend_bytes_out_total" - "haproxy_backend_http_responses_total" - "haproxy_server_status" - "haproxy_frontend_current_sessions" - "haproxy_backend_current_sessions" - "haproxy_server_current_sessions" - "haproxy_backend_connect_time_average_seconds" - "haproxy_backend_response_time_average_seconds"EOFCreate or edit the file C:\ProgramData\glouton\conf.d\99-haproxy.conf:
metric: prometheus: targets: - url: "http://localhost:8405/metrics" name: "haproxy" allow_metrics: - "haproxy_process_current_connections" - "haproxy_process_uptime_seconds" - "haproxy_frontend_bytes_in_total" - "haproxy_frontend_bytes_out_total" - "haproxy_backend_http_responses_total" - "haproxy_server_status" - "haproxy_frontend_current_sessions" - "haproxy_backend_current_sessions" - "haproxy_server_current_sessions" - "haproxy_backend_connect_time_average_seconds" - "haproxy_backend_response_time_average_seconds"Glouton automatically detects configuration changes.
| Metric | Description |
|---|---|
haproxy_process_current_connections | Current number of connections on the HAProxy process |
haproxy_process_uptime_seconds | HAProxy process uptime in seconds |
haproxy_frontend_bytes_in_total | Total bytes received by all frontends |
haproxy_frontend_bytes_out_total | Total bytes sent by all frontends |
haproxy_backend_http_responses_total | Total HTTP responses from backends, by status code |
haproxy_server_status | Current status of each backend server (1 = UP, 0 = DOWN) |
haproxy_frontend_current_sessions | Number of current sessions on each frontend |
haproxy_backend_current_sessions | Number of current sessions on each backend |
haproxy_backend_connect_time_average_seconds | Average backend connection time in seconds |
haproxy_backend_response_time_average_seconds | Average backend response time in seconds |
Glouton automatically collects HAProxy logs when available.
Monitoring Troubleshooting
Section titled “Monitoring Troubleshooting”See Troubleshoot a Service Check or Missing Metrics for what applies to every service: finding the address and port Glouton really uses, what each check message means, and how to read the collection error — which does not appear in the agent logs at the default level.
The Service Check is not OK
Section titled “The Service Check is not OK”The check only opens the TCP port — it sends no command — so it fails when the
port is wrong (Connection refused), when a firewall drops the packets
(connection timed out after 10 seconds), or when the configured address
cannot be parsed (Invalid TCP address). A green check proves the port is
open, and nothing more.
Metrics are Missing
Section titled “Metrics are Missing”Glouton has no default for the HAProxy statistics endpoint: without
stats_url in the service configuration, no collector is created at all and
the service reports only service_status.
Reproduce what Glouton does, from the machine where the agent runs:
curl -s "http://127.0.0.1:8404/stats;csv" | head -2| What you see | Cause | Fix |
|---|---|---|
| nothing — the collector is never created | stats_url not set |
Set stats_url to the stats page or to the admin socket |
404, or a connection error |
The stats page is not enabled | Add a stats enable / stats uri listener to haproxy.cfg |
| parsing errors | The URL does not return CSV | Append ;csv to the stats URL |
401 |
The stats page requires authentication | Put the credentials in the URL: http://user:password@127.0.0.1:8404/stats;csv |
permission denied |
The admin socket is not readable by the agent | Give the glouton user access to the socket, or use the HTTP stats page |