add all the collectd basics.
This commit is contained in:
parent
9cacbc4594
commit
55b54a537b
16 changed files with 224 additions and 0 deletions
25
files/collectd/collectd_haproxy.sh
Normal file
25
files/collectd/collectd_haproxy.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
sock='/var/run/haproxy-stat'
|
||||
host="$(hostname -s)"
|
||||
pause=10
|
||||
|
||||
while getopts "h:p:s:" c; do
|
||||
case $c in
|
||||
h) host=$OPTARG;;
|
||||
p) pause=$OPTARG;;
|
||||
s) sock=$OPTARG;;
|
||||
*) echo "Usage: $0 [-h <hostname>] [-p <seconds>] [-s <sockfile>]";;
|
||||
esac
|
||||
done
|
||||
|
||||
while [ $? -eq 0 ]; do
|
||||
time="$(date +%s)"
|
||||
echo 'show stat' | socat - UNIX-CLIENT:$sock \
|
||||
|while IFS=',' read pxname svname qcur qmax scur smax slim stot bin bout dreq dresp ereq econ eresp wretr wredis status weight act bck chkfail chdown lastchg downtime qlimit pid iid sid throttle lbtot tracked type; do
|
||||
[ "$svname" != 'BACKEND' ] && continue
|
||||
echo "PUTVAL $host/haproxy/haproxy_backend-$pxname $time:$stot:$econ:$eresp"
|
||||
done
|
||||
sleep $pause
|
||||
done
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue