how to view haproxy status on the command line using a socket
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Isolated
--
Chapters
00:00 How To View Haproxy Status On The Command Line Using A Socket
00:46 Accepted Answer Score 35
01:30 Thank you
--
Full question
https://superuser.com/questions/1193917/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #commandline #sockets #haproxy
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Isolated
--
Chapters
00:00 How To View Haproxy Status On The Command Line Using A Socket
00:46 Accepted Answer Score 35
01:30 Thank you
--
Full question
https://superuser.com/questions/1193917/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #commandline #sockets #haproxy
#avk47
ACCEPTED ANSWER
Score 35
I found the following to be useful
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'
It will produce output as follows
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
Now the columns are lined up and any only columns I am interested in are being shown.
If you want to know what the column numbers are for this cut command will help.
echo "show stat" | nc -U /var/lib/haproxy/stats | grep "#" | tr ',' '\n' | nl