[4] Statystyki CLI
7 lutego 2022Skonfigurujemy teraz HAProxy, aby móc zobaczyć jego statystyki w linii komend.
[1] Zainstaluj wymagane pakiety.
[root@vlsr01 ~]# dnf install socat
[2] Skonfiguruj HAProxy.
[root@vlsr01 ~]# mcedit /etc/haproxy/haproxy.cfg #potwierdź ustawienia #wszystko jest OK, jeśli poniższa linia w sekcji [global] istnieje global log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats ssl-default-bind-ciphers PROFILE=SYSTEM ssl-default-server-ciphers PROFILE=SYSTEM
[3] Zapoznaj się ze statystykami, jak poniżej.
#pokaż aktualne statystyki [root@vlsr01 ~]# echo "show info" | socat /var/lib/haproxy/stats stdio Name: HAProxy Version: 1.8.27-493ce0b Release_date: 2020/11/06 Nbthread: 1 Nbproc: 1 Process_num: 1 Pid: 12925 Uptime: 0d 0h01m08s . . . . . Idle_pct: 100 node: vlsr01.zicher.lab Stopping: 0 Jobs: 4 Listeners: 3 # wyświetlaj aktualne statystyki w stylu CSV [root@vlsr01 ~]# echo "show stat" | socat /var/lib/haproxy/stats 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, http-in,FRONTEND,,,0,1,3000,3,18480,288691,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,1,,,,0,32,0,0,0,0,,0,7,32,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,1,3,0,0,0, backend_servers,node01,0,0,0,1,,7,4223,2688,,0,,0,0,0,0,UP,1,1,0,0,0,196,0,,1,3,1,,7,,2,0,,3,L4OK,,0,0,7,0,0,0,0,,,,,0,0,,,,,55,,,0,0,1,16,,,,Layer4 check passed,,2,3,4,,,,192.168.100.102:80,,http,,,,,,,, backend_servers,node02,0,0,0,1,,6,3642,2304,,0,,0,0,0,0,UP,1,1,0,0,0,196,0,,1,3,2,,6,,2,0,,4,L4OK,,0,0,6,0,0,0,0,,,,,0,0,,,,,56,,,0,0,0,7,,,,Layer4 check passed,,2,3,4,,,,192.168.100.103:80,,http,,,,,,,, backend_servers,BACKEND,0,0,0,1,300,32,18480,288691,0,0,,0,0,0,0,UP,2,2,0,,0,196,0,,1,3,0,,13,,1,0,,7,,,,0,32,0,0,0,0,,,,32,0,0,0,0,0,0,52,,,0,0,1,36,,,,,,,,,,,,,,http,roundrobin,,,,,,, #pokaż aktualną sesję [root@vlsr01 ~]# echo "show sess" | socat /var/lib/haproxy/stats stdio 0x555eb74968b0: proto=unix_stream src=unix:1 fe=GLOBAL be=<NONE> srv=<none> ts=08 age=0s calls=1 rq[f=40c0c223h,i=0,an=00h,rx=,wx=,ax=] rp[f=80008000h,i=0,an=00h,rx=,wx=,ax=] s0=[7,8h,fd=11,ex=] s1=[7,4018h,fd=-1,ex=] exp=10s run(nice=-64)