Debian 12 bookworm
Sponsored Link

HAProxy : Refer to the Statistics (CUI)2023/07/10

 
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.6.12-1
Release_date: 2023/04/01
Nbthread: 2
Nbproc: 1
Process_num: 1
Pid: 1035
Uptime: 0d 0h16m23s
Uptime_sec: 983
Memmax_MB: 0
PoolAlloc_MB: 0
PoolUsed_MB: 0
PoolFailed: 0
Ulimit-n: 524287
Maxsock: 524287
Maxconn: 262122
Hard_maxconn: 262122
.....
.....

# 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,eint,idle_conn_cur,safe_conn_cur,used_conn_cur,need_conn_est,uweight,agg_server_status,agg_server_check_status,agg_check_status,-,ssl_sess,ssl_reused_sess,ssl_failed_handshake,h2_headers_rcvd,h2_data_rcvd,h2_settings_rcvd,h2_rst_stream_rcvd,h2_goaway_rcvd,h2_detected_conn_protocol_errors,h2_detected_strm_protocol_errors,h2_rst_stream_resp,h2_goaway_resp,h2_open_connections,h2_backend_open_streams,h2_total_connections,h2_backend_total_streams,h1_open_connections,h1_open_streams,h1_total_connections,h1_total_streams,h1_bytes_in,h1_bytes_out,h1_spliced_bytes_in,h1_spliced_bytes_out,
http-in,FRONTEND,,,0,3,262122,47,70048,173267,0,0,3,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,3,,,,0,20,0,80,0,0,,0,3,100,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,3,47,0,0,0,0,,,0,0,,,,,,,0,,,,,,,,,-,26,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,97,76393,168853,0,0,
backend_servers,node01,0,0,0,1,,31,20700,13233,,0,,0,0,0,0,UP,1,1,0,0,0,1031,0,,1,3,1,,31,,2,0,,1,L4OK,,0,0,6,0,25,0,0,,,,31,0,0,,,,,192,,,0,1,1,1774,,,,Layer4 check passed,,2,3,4,,,,10.0.0.51:80,,http,,,,,,,,0,23,8,,,0,,0,1,1,28977,0,0,0,0,1,1,,,,-,0,0,0,,,,,,,,,,,,,,,,,,,,,,
backend_servers,node02,0,0,0,1,,30,20264,12756,,0,,0,0,0,0,UP,1,1,0,0,0,1031,0,,1,3,2,,30,,2,0,,1,L4OK,,0,0,7,0,23,0,0,,,,30,0,0,,,,,224,,,0,1,1,4498,,,,Layer4 check passed,,2,3,4,,,,10.0.0.52:80,,http,,,,,,,,0,23,7,,,0,,0,1,1,29423,0,0,0,0,1,1,,,,-,0,0,0,,,,,,,,,,,,,,,,,,,,,,
backend_servers,BACKEND,0,0,0,1,26213,97,70048,173267,0,0,,0,0,0,0,UP,2,2,0,,0,1031,0,,1,3,0,,61,,1,0,,2,,,,0,20,0,77,0,0,,,,97,58,0,0,0,0,0,192,,,0,1,1,2219,,,,,,,,,,,,,,http,roundrobin,,,,,,,0,46,15,0,0,,,0,1,1,29423,0,,,,,2,0,0,0,-,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,46,61,26310,44960,0,0,

# display current session

root@dlp:~#
echo "show sess" | socat /run/haproxy/admin.sock stdio
0x563401d6aae0: proto=unix_stream src=unix:1 fe=GLOBAL be=<NONE> srv=<none> ts=00 epoch=0 age=0s calls=2 rate=1 cpu=0 lat=0 rq[f=c0c020h,i=0,an=00h,rx=,wx=,ax=] rp[f=80008000h,i=0,an=00h,rx=,wx=,ax=] scf=[8,0h,fd=14] scb=[8,1h,fd=-1] exp=30s rc=0 c_exp=
Matched Content