Example Monitoring HAProxy

Example 1:

listen stats *:1936
    stats enable
    stats uri /
    stats hide-version
    stats auth someuser:password

listen stats *:1936 – Use the listen directive, name it stats and have it listen on port 1936.
stats enable – Enable the stats monitoring dashboard
stats uri / – The URI to reach it is just / (on port 1936)
stats hide-version – Hide the version of HAProxy used
stats auth someuser:password – Use HTTP basic authentication, with the set username and password. In this example, the username is someuser and the password is just password. Don’t use that in production – in fact, make sure your firewall blocks external HTTP access to that port.

Now you can access http://your_ip:1936 and login with someuser:password

haproxy stat

Example 2:

frontend http
	bind :8080
	default_backend stats

backend stats
	mode http
	stats enable	
	stats uri	 /
	stats refresh 1s
	stats show-legends
	stats admin if TRUE

Now you can access http://your_ip:8080

Leave a Reply