How to Enable HAProxy Stats

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 Stats in HAProxy

To enable stats edit your haproxy configuration file and add below entry after 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

Your can access HAProxy stats using following url. Change ip with your haproxy server ip address.

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

haproxy-stats

Step 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.

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.

Rahul

Founder of TecAdmin.net. I love to work with Linux and other open source application. Also I like to share knowledge with my friends and other Linux users. Follow me on Twitter, Add me on Google+ or Like Facebook page.

Leave a Reply