Skip to content

HAProxy

Auto-Detection
Built-in Metrics
Prometheus Metrics
Logs

Bleemeo monitors HAProxy through its stats page (all versions) or its native Prometheus endpoint (2.0+).

Glouton automatically detects HAProxy instances running on the system.

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.

Add a statistics endpoint to your HAProxy configuration:

frontend api-http
bind 0.0.0.0:80
stats enable
stats uri /statistics
Terminal window
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"
EOF

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

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.

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 log

Reload HAProxy to apply the change:

Terminal window
sudo systemctl reload haproxy

You can verify the endpoint is working by visiting http://localhost:8405/metrics.

Terminal window
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"
EOF

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.