Enable HAProxy stats in Cent OS

HAProxy Stats provides a lot of information about data transfer, total connection, server state etc. After installing HAProxy if you want to view HAProxy stats in your web browser, You can easily configure it by making few changes in your HAProxy configuration using following steps.

1: Enable Stats in HAProxy

To enable stats edit your haproxy configuration file(/etc/haproxy/haproxy.cfg) and add below entry after defaults section.
listen stats
mode http
log global

maxconn 10

clitimeout 100s
srvtimeout 100s
contimeout 100s
timeout queue 100s

stats enable
stats hide-version
stats refresh 30s
stats show-node
stats auth admin:password
stats uri /haproxy?stats

2: Access HAProxy Stats

Your can access HAProxy stats using following url. Change ip with your haproxy server ip address.
Login user: admin
Login password: password

3: Change Login Details

If you want to changed login details of HAProxy stats, edit your configuration and update “stats auth” value like below

stats auth username:password

Save configuration file and restart HAProxy to update service.

4: Change HAProxy Stats URL

To change url of haproxy stats edit configuration file and update following value.
stats uri /ha-stats
stats uri /stats

Save configuration file and restart HAProxy to update service.
service haproxy restart

Now you can access url like or

Congratulation’s! HAProxy stats configuration has been completed successfully. Read next article to setup ACL in HAProxy.

Post a Comment Blogger