nel*_*aro 16 linux command-line sockets haproxy
在例子中,我在网上看到
https://www.datadoghq.com/blog/how-to-collect-haproxy-metrics/#show-me-the-metrics
您可以使用命令行
echo "show stat" | nc -U /var/lib/haproxy/stats
Run Code Online (Sandbox Code Playgroud)
这在输出中非常难看。列不匹配,很难看出发生了什么。
# 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,
someapp,FRONTEND,,,1,1,512,1,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,1,,,,,,,,,,,0,0,0,,,0,0,0,0,,,,,,,,
anotherdb,anotherdb-tp-01,0,0,1,1,,1,0,0,,0,,0,0,0,0,no check,1,1,0,,,,,,1,2,1,,1,,2,0,,1,,,,,,,,,,0,,,,0,0,,,,,3006,,,0,0,0,0,
someotherappdb,BACKEND,0,0,1,1,52,1,0,0,0,0,,0,0,0,0,UP,1,1,0,,0,3008,0,,1,2,0,,1,,1,0,,1,,,,,,,,,,,,,,0,0,0,0,0,0,3006,,,0,0,0,0,
Run Code Online (Sandbox Code Playgroud)
有没有一种好方法来清理它并使其更具可读性。
nel*_*aro 26
我发现以下内容很有用
watch 'echo "show stat" | nc -U /var/lib/haproxy/stats | cut -d "," -f 1,2,5-11,18,24,27,30,36,50,37,56,57,62 | column -s, -t'
Run Code Online (Sandbox Code Playgroud)
它将产生如下输出
Every 2.0s: echo "show stat" | nc -U /var/lib/haproxy/stats | cut -d "," -f 1,2,5-11,18,24,27,30,36,50,37,56,57,62 | column -s, -t Thu Mar 30 15:01:19 2017
# pxname svname scur smax slim stot bin bout dreq status lastchg pid throttle rate_max check_status cli_abrt lastsess last_chk ttime
somedb FRONTEND 1 1 512 1 0 0 0 OPEN 1 1
appp01 coolappss-01 1 1 1 0 0 no check 1 1 0 2973 0
coredb BACKEND 1 1 52 1 0 0 0 UP 2975 1 1 0 2973 0
Run Code Online (Sandbox Code Playgroud)
现在这些列已经排成一排,并且任何我感兴趣的列都将显示出来。
如果您想知道此剪切命令的列号是多少会有所帮助。
echo "show stat" | nc -U /var/lib/haproxy/stats | grep "#" | tr ',' '\n' | nl
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
34672 次 |
| 最近记录: |