• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Enable HAProxy Stats

Written by Rahul, Updated on October 1, 2020

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.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

6 Comments

  1. Avatar JR Reply
    September 30, 2020 at 9:00 pm

    My stats page is working fine but seems like I can only get to it thru IP. I have a DNS server and it resolves but if i do like http://haproxy.REMOVED.local:9136 it doesn’t work. But if I go to http://192.168.0.60:9136/ it works. Pinging haproxy.REMOVED.local resolves.

  2. Avatar Ratha Reply
    July 31, 2019 at 10:04 am

    bellow my config file,

    But statics is not work. I can’t access via browser.

    any recommand?
    =======================================================================================
    global
    log 127.0.0.1 local2

    chroot /var/lib/haproxy
    pidfile /var/run/haproxy.pid
    maxconn 40000
    user haproxy
    group haproxy
    daemon

    stats socket /var/run/haproxy.cmd

    defaults
    mode http
    log global
    option httplog
    option dontlognull
    option http-server-close
    option forwardfor except 127.0.0.0/8
    option redispatch
    retries 3
    timeout http-request 10s
    timeout queue 30s
    timeout connect 10s
    timeout client 1m
    timeout server 1m
    timeout http-keep-alive 10s
    timeout check 10s
    maxconn 30000

    listen stats 192.168.0.8:80
    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

    frontend M_Apps
    bind 192.168.0.8:80
    default_backend M_Apps_GW

    backend M_Apps_GW
    balance roundrobin
    server web1 192.168.0.5:80 check
    server web2 192.168.0.6:80 check

    frontend POS_Apps
    bind 192.168.0.8:8080
    default_backend POS_GW

    backend POS_GW
    balance roundrobin
    server web1 192.168.0.9:8080 check
    server web2 192.168.0.10:8080 check

    • Rahul Rahul Reply
      July 31, 2019 at 10:13 am

      What are you getting on browser?

  3. Avatar SDB Reply
    August 3, 2018 at 9:06 am

    I don’t want to show ha-proxy stats on HTTP protocol, I wanted to have it with HTTPS only.
    What is the steps to configure this ?

  4. Avatar Chetan Reply
    August 12, 2015 at 7:47 am

    stats page is not opening
    also disabled selinux
    this is my configuration file

    listen stats 10.0.0.128: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 haproxy:redhat
    stats uri /haproxy?stats

    # [HTTP Site Configuration]
    listen http_web 10.0.0.128:80
    mode http
    balance roundrobin # Load Balancing algorithm
    option httpchk
    option forwardfor
    server server1 10.0.0.130:80 weight 1 maxconn 512 check
    server server2 10.0.0.131:80 weight 1 maxconn 512 check

    • Avatar lakshmikandan Reply
      April 29, 2016 at 4:52 am

      Hi CHETAN,

      You must check the haproxy version, or you can use this,

      #view on UI
      listen stats
      bind :1936
      mode http
      log global
      maxconn 10
      stats enable
      stats hide-version
      stats refresh 30s
      stats show-node
      stats auth hadproxy:password
      stats uri /haproxy?stats

      Finally, restart the haproxy server.

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How To Install Python 3.9 on Ubuntu 18.04 0
  • How to Use AppImage on Linux (Beginner Guide) 2
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy