fuel-library/files/fuel-misc/haproxy-status.sh
Vladimir Kuklin 0ccd804849 Backward-compatible commit for packaging of fuel-library
based on Change-Id: Ie759857fb94db9aa94aaeaeda2c6ab5bb159cc9e
All the work done for fuel-library packaging

Should be overriden by the change above after we switch
CI to package-based

implements blueprint: package-fuel-components

Change-Id: I48ed37a009b42f0a9a21cc869a869edb505b39c3
2015-04-16 11:23:29 +03:00

49 lines
787 B
Bash

#!/bin/sh
show_stats() {
echo 'show stat' | socat 'UNIX-CONNECT:/var/lib/haproxy/stats' STDIO | awk \
'
function fillstr(string, num)
{
len=length(string);
if (len>=num)
{
printf("%s",substr(string,1,num));
}
else
{
printf("%s",string);
for(i=1; i<=num-len; i++)
{
printf(" ");
}
}
}
BEGIN {
FS = ",";
};
{
if ($1 ~ /^#/) { next };
if ($1 == "") { next };
status=sprintf("Status: %s",$18);
if ($37 != "") {
status=status sprintf("/%s",$37);
}
sessions=sprintf("Sessions: %s",$5);
rate=sprintf("Rate: %s",$34);
fillstr($1,25);
fillstr($2,15);
fillstr(status,20);
fillstr(sessions,15);
fillstr(rate,10);
printf("\n");
}
'
}
show_stats