Monitoring HAProxy - Configuring the HAProxy Stats page

Monitoring HAProxy - Configuring the HAProxy Stats page

To effectively monitor an HAProxy instance, you can enable and access the HAProxy stats page, which provides real-time metrics about HAProxy's performance.

Steps to Enable HAProxy Stats:
  • Open the HAProxy Configuration File: The HAProxy configuration file is usually located at /etc/haproxy/haproxy.cfg. Open it using a text editor.
  • Add the Stats Configuration: At the end of the haproxy.cfg file, add the following configuration to enable the stats page:
Quote
isten stats :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth Username:Password
  • Restart HAProxy: After making the changes, restart the HAProxy service to apply the new configuration. This will open up the stats in the port '9000' (we have specified 9000 as the port in the configuration).
  • You can further add the same HAProxy for monitoring using the hostname and port.

Notes
Notes:
  1. You can change the port (9000 by default) to any free port that you wish to use.
  2. The line number 7 is for setting up basic authentication for this stats url. A user can provide his own username and password
  3. We use the following URL to collect metrics: http://[HOSTNAME]:[PORT]/;csv
  4. 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?