Ubuntu 20.04
Sponsored Link

HAProxy : Refer to the Statistics (CUI)2020/09/04

 
Configure HAProxy to see HAProxy Statistics Reports with commands.
[1] Install required package.
root@dlp:~#
apt -y install socat
[2] Configure HAProxy.
root@dlp:~#
vi /etc/haproxy/haproxy.cfg
# confirm settings

# OK if following line exists in [global] section

global
        stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners

root@dlp:~#
systemctl restart haproxy

[3] Refer to the Statistics like follows.
# display current stats

root@dlp:~#
echo "show info" | socat /run/haproxy/admin.sock stdio

Name: HAProxy
Version: 2.0.13-2
Release_date: 2020/04/01
Nbthread: 2
Nbproc: 1
Process_num: 1
Pid: 2792
Uptime: 0d 0h10m37s
Uptime_sec: 637
.....
.....
ConnectedPeers: 0
DroppedLogs: 0
BusyPolling: 0
FailedResolutions: 0
TotalBytesOut: 31344
BytesOutRate: 0

# display current stats with CSV style

root@dlp:~#
echo "show stat" | socat /run/haproxy/admin.sock stdio
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,wrew,connect,reuse,cache_lookups,cache_hits,srv_icur,src_ilim,qtime_max,ctime_max,rtime_max,ttime_max,
http-in,FRONTEND,,,0,1,490,4,1470,17551,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,1,,,,0,1,0,4,0,0,,0,2,5,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,1,4,0,0,0,0,,,0,0,,,,,,,
backend_servers,node01,0,0,0,1,,1,229,440,,0,,0,0,0,0,UP,1,1,0,0,0,701,0,,1,3,1,,1,,2,0,,1,L4OK,,0,0,0,0,1,0,0,,,,,0,0,,,,,647,,,0,1,1,1,,,,Layer4 check passed,,2,3,4,,,,10.0.0.51:80,,http,,,,,,,,0,1,0,,,0,,0,1,1,7,
backend_servers,node02,0,0,0,1,,1,276,440,,0,,0,0,0,0,UP,1,1,0,0,0,701,0,,1,3,2,,1,,2,0,,1,L4OK,,0,0,0,0,1,0,0,,,,,0,0,,,,,565,,,0,0,1,1,,,,Layer4 check passed,,2,3,4,,,,10.0.0.52:80,,http,,,,,,,,0,1,0,,,0,,0,0,1,61,
backend_servers,BACKEND,0,0,0,1,49,5,1470,17551,0,0,,0,0,0,0,UP,2,2,0,,0,701,0,,1,3,0,,2,,1,0,,2,,,,0,1,0,4,0,0,,,,5,0,1,0,0,0,0,565,,,0,0,1,1,,,,,,,,,,,,,,http,roundrobin,,,,,,,0,2,0,0,0,,,0,1,1,61,

# display current session

root@dlp:~#
echo "show sess" | socat /run/haproxy/admin.sock stdio
0x7f56640235d0: proto=unix_stream src=unix:1 fe=GLOBAL be=<NONE> srv=<none> ts=00 age=0s calls=1 rate=1 cpu=0 lat=0 rq[f=c4c220h,i=0,an=00h,rx=,wx=,ax=] rp[f=80008000h,i=0,an=00h,rx=,wx=,ax=] s0=[8,280008h,fd=15,ex=] s1=[8,204018h,fd=-1,ex=] exp=
Matched Content