Révision 4f29ff59
Add support for sockets
| plugins/haproxy/haproxy_responses_frontend | ||
|---|---|---|
| 13 | 13 |
user root |
| 14 | 14 |
env.backend backend_name_1 backend_name_2 backend_name_3 |
| 15 | 15 |
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 |
| 16 |
env.url http://user:passwd@IP:port/admin?stats;csv |
|
| 16 |
# You can use url o socket option, use one of them, not both! |
|
| 17 |
env.url http://user:passwd@IP:port/admin?stats;csv |
|
| 18 |
# or |
|
| 19 |
env.socket /var/lib/haproxy/stats.socket |
|
| 17 | 20 |
|
| 18 | 21 |
=head1 AUTHOR |
| 19 | 22 |
|
| ... | ... | |
| 39 | 42 |
PXNAME="$1" |
| 40 | 43 |
SVNAME="$2" |
| 41 | 44 |
VALUE="$3" |
| 42 |
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` |
|
| 43 |
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` |
|
| 45 |
|
|
| 46 |
if [ ! -z "$url" ]; then |
|
| 47 |
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` |
|
| 48 |
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` |
|
| 49 |
fi |
|
| 50 |
|
|
| 51 |
if [ ! -z "$socket" ]; then |
|
| 52 |
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'` |
|
| 53 |
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"` |
|
| 54 |
fi |
|
| 44 | 55 |
|
| 45 | 56 |
ARRAY1=($LINE1); |
| 46 | 57 |
|
| ... | ... | |
| 119 | 130 |
H3xx=`parse_url ${i} ${SVNAME} hrsp_3xx`
|
| 120 | 131 |
H4xx=`parse_url ${i} ${SVNAME} hrsp_4xx`
|
| 121 | 132 |
H5xx=`parse_url ${i} ${SVNAME} hrsp_5xx`
|
| 122 |
Hoxx=`parse_url ${i} ${SVNAME} hrsp_other`
|
|
| 133 |
Hother=`parse_url ${i} ${SVNAME} hrsp_other`
|
|
| 123 | 134 |
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H1xx" |
| 124 | 135 |
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H2xx" |
| 125 | 136 |
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H3xx" |
| 126 | 137 |
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H4xx" |
| 127 | 138 |
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H5xx" |
| 128 |
echo "hrsp_oxx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hoxx"
|
|
| 139 |
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hother"
|
|
| 129 | 140 |
done |
| 130 | 141 |
|
Formats disponibles : Unified diff