Monitoring HAProxy - Configuring the HAProxy Stats page
To monitor a HAProxy instance:
- Open the 'stats' port for collecting the metrics.
- To enable metrics collection, add the following content at the bottom of the file /etc/haproxy/haproxy.cfg:
listen stats :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth Username:Password
- Restart the HAProxy instance. This will open up the stats in the port '9000' (we have specified 9000 as the port in this configuration). You can further add the same HAProxy for monitoring using the hostname and port.
Note:
- You can change the port (9000 by default) to any free port that you wish to use.
- The line number 7 is for setting up basic authentication for this stats url. A user can provide his own username and password
- We use the following URL to collect metrics: http://[HOSTNAME]:[PORT]/;csv (Replace [HOSTNAME] and [PORT] with the respective hostname of the HAProxy instance and port which is mentioned in the above configuration).
New to ADSelfService Plus?