Haproxy
Jump to navigation
Jump to search
frontend stats
bind *:8404
stats enable
# stats uri /stats
stats uri /stats
stats refresh 10s
mode http
stats auth admin:admin
# stats admin if LOCALHOST
# acl network_allowed src 10.x.x.x 1.1.1.1 2.2.2.2 10.0.0.0/8
# stats admin if network_allowed
- http://10.x.x.x:8404/stats
- http://10.x.x.x:8404/stats?stats;csv;norefresh
- https://github.com/bcicen/haproxy-stats
#!/usr/bin/env python3
import time
from haproxystats import HAProxyServer
haproxy = HAProxyServer('10.64.4.51:8404/stats')
while True:
json = haproxy.to_json()
time.sleep(5)
print(json)
from haproxystats import HAProxyServer
haproxy = HAProxyServer('10.64.4.51:8404/stats')
for b in haproxy.backends:
print('%s: %s' % (b.name, b.status))
haproxy.to_json()