HAProxy : 統計情報を参照する#22018/12/04 |
HAProxy サーバーの統計情報がコマンドで参照できるように設定します。
|
|
[1] | 必要なパッケージをインストールしておきます。 |
root@dlp:~# apt -y install socat
|
[2] | HAProxy の設定です。 |
root@dlp:~#
vi /etc/haproxy/haproxy.cfg # 設定確認 (stats socket *** が指定されていれば OK) global stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listenersroot@dlp:~# systemctl restart haproxy |
[3] | 以上の設定の後、以下のようにして参照可能です。 |
# 現在の状態を表示 root@dlp:~# echo "show info" | socat /run/haproxy/admin.sock stdio Name: HAProxy Version: 1.8.8-1ubuntu0.2 Release_date: 2018/10/02 Nbthread: 1 Nbproc: 1 Process_num: 1 Pid: 1818 Uptime: 0d 0h15m10s Uptime_sec: 910 ..... ..... MaxZlibMemUsage: 0 Tasks: 7 Run_queue: 1 Idle_pct: 100 node: dlp.srv.world # 統計情報を CSV 形式で出力 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, http-in,FRONTEND,,,1,1,2000,20,7774,211110,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,1,,,,0,14,0,7,0,0,,0,2,21,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,0,1,20,0,0,0, backend_servers,node01,0,0,0,1,,1,234,449,,0,,0,0,0,0,UP,1,1,0,0,0,1037,0,,1,3,1,,1,,2,0,,1,L4OK,,0,0,0,0,1,0,0,,,,,0,0,,,,,965,,,0,0,1,1,,,,Layer4 check passed,,2,3,4,,,,10.0.0.51:80,,http,,,,,,,, backend_servers,node02,0,0,0,1,,1,294,449,,0,,0,0,0,0,UP,1,1,0,0,0,1037,0,,1,3,2,,1,,2,0,,1,L4OK,,0,0,0,0,1,0,0,,,,,0,0,,,,,965,,,0,1,0,1,,,,Layer4 check passed,,2,3,4,,,,10.0.0.52:80,,http,,,,,,,, backend_servers,BACKEND,0,0,0,1,200,21,7774,211110,0,0,,0,0,0,0,UP,2,2,0,,0,1037,0,,1,3,0,,2,,1,0,,2,,,,0,14,0,7,0,0,,,,21,0,0,0,0,0,0,6,,,0,0,0,1,,,,,,,,,,,,,,http,roundrobin,,,,,,, # 現在のセッションを表示 root@dlp:~# echo "show sess" | socat /run/haproxy/admin.sock stdio
0x561ddeaab630: proto=tcpv4 src=10.0.0.18:37972 fe=http-in be=<NONE> srv=<none> ts=08 age=34s calls=4 rq[f=4400000h,i=0,an=34h,rx=15s,wx=,ax=] rp[f=80000000h,i=0,an=00h,rx=,wx=,ax=] s0=[7,8h,fd=11,ex=] s1=[0,10h,fd=-1,ex=] exp=15s 0x561ddeaac570: proto=unix_stream src=unix:1 fe=GLOBAL be=<NONE> srv=<none> ts=0a age=0s calls=1 rq[f=40c0c220h,i=0,an=00h,rx=,wx=,ax=] rp[f=80008002h,i=0,an=00h,rx=,wx=,ax=] s0=[7,8h,fd=12,ex=] s1=[7,4018h,fd=-1,ex=] exp= |
Sponsored Link |