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.

Step 1 – Enable HAProxy Statics

You can enable statics in haproxy server. To enable stats edit your HAProxy configuration file and add below entry after the defaults section.

listen  stats   192.168.10.10:1936
        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

Step 2 – Access HAProxy Stats

You can access HAProxy stats using the following URL. Use your server ip address followed by stats uri in above configuration. Use login details conigured with stats auth in configuration file.

 URL: http://192.168.10.10:1936/haproxy?stats
 Login user: admin
 Login password: password

enable haproxy stats

Step 3 – Change Login Details

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

stats auth  username:password

Save the configuration file and restart HAProxy to update service.

Step 4 – Change HAProxy Stats URL

To change url of haproxy stats edit configuration file and update following value.

stats uri  /ha-stats
or
stats uri  /stats

Save configuration file and restart HAProxy to update service. Now you can access url like http://192.168.10.10:1936/ha-stats or http://192.168.10.10:1936/stats.

Haproxy stats configuration has been completed successfully.