2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Add support for sockets

This commit is contained in:
rfrail3 2012-09-17 10:49:02 +02:00
parent a717a91344
commit 4f29ff59b1
19 changed files with 306 additions and 60 deletions

View file

@ -13,7 +13,10 @@ haproxy_aborts_backend -Haproxy Aborts Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_active_backend -Haproxy servers active backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
# Find values # Find values

View file

@ -13,7 +13,10 @@ haproxy_bytes_backend -Haproxy Bytes Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_bytes_frontend -Haproxy Bytes Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_denied_backend -Haproxy Denied Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_denied_frontend -Haproxy Denied Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_errors_backend -Haproxy Errors Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_errors_frontend -Haproxy Errors Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_queue_backend -Haproxy Queued Requests Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
@ -63,6 +73,7 @@ function parse_url {
SVNAME='BACKEND' SVNAME='BACKEND'
LIST=$backend LIST=$backend
WARN_PERCENT="80"
@ -91,6 +102,20 @@ if [ "$1" = "config" ]; then
#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE" #echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0" #echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max queued request $i" #echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max queued request $i"
echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Limit request `echo $i | awk -F. '{print $NF}'`"
echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit request `echo $i | awk -F. '{print $NF}'`"
QLIM=`parse_url ${i} ${SVNAME} qlimit`
if [[ "$QLIM" =~ ^[0-9]+$ ]] && [[ "$QLIM" != 0 ]]; then
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $QLIM"
fi
if [[ "$QLIM" =~ ^[0-9]+$ ]] && [[ "$QLIM" != 0 ]]; then
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${QLIM}*${WARN_PERCENT}/100))"
fi
done done
exit 0 exit 0
@ -98,8 +123,10 @@ fi
for i in ${LIST}; do for i in ${LIST}; do
QCUR=`parse_url ${i} ${SVNAME} qcur` QCUR=`parse_url ${i} ${SVNAME} qcur`
#QMAX=`parse_url ${i} ${SVNAME} qmax` #QMAX=`parse_url ${i} ${SVNAME} qmax`
QLIM=`parse_url ${i} ${SVNAME} qlimit`
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QCUR" echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QCUR"
echo "qlim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QLIM"
#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QMAX" #echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QMAX"
done done

View file

@ -13,7 +13,10 @@ haproxy_rate_backend -Haproxy Sessions Per Second Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
@ -63,6 +73,7 @@ function parse_url {
SVNAME='BACKEND' SVNAME='BACKEND'
LIST=$backend LIST=$backend
WARN_PERCENT="80"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
@ -95,6 +106,15 @@ if [ "$1" = "config" ]; then
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0" #echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max number of new sessions per second $i" #echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max number of new sessions per second $i"
RATEL=`parse_url ${i} ${SVNAME} rate_lim`
if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $RATEL"
fi
if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${RATEL}*${WARN_PERCENT}/100))"
fi
done done
exit 0 exit 0

View file

@ -13,7 +13,10 @@ harpoxy_rate_frontend -Haproxy Sessions Per Second Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
@ -63,6 +73,7 @@ function parse_url {
SVNAME='FRONTEND' SVNAME='FRONTEND'
LIST=$frontend LIST=$frontend
WARN_PERCENT="80"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
@ -96,6 +107,14 @@ if [ "$1" = "config" ]; then
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0" #echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max number of new sessions per second $i" #echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max number of new sessions per second $i"
RATEL=`parse_url ${i} ${SVNAME} rate_lim`
if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $RATEL"
fi
if [[ "$RATEL" =~ ^[0-9]+$ ]] && [[ "$RATEL" != 0 ]]; then
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${RATEL}*${WARN_PERCENT}/100))"
fi
done done
exit 0 exit 0

View file

@ -13,7 +13,10 @@ haproxy_reqrate_frontend -Haproxy request rate frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_responses_backend -Haproxy responses backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,8 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_responses_frontend -Haproxy responses frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,8 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
@ -119,12 +130,12 @@ fi
H3xx=`parse_url ${i} ${SVNAME} hrsp_3xx` H3xx=`parse_url ${i} ${SVNAME} hrsp_3xx`
H4xx=`parse_url ${i} ${SVNAME} hrsp_4xx` H4xx=`parse_url ${i} ${SVNAME} hrsp_4xx`
H5xx=`parse_url ${i} ${SVNAME} hrsp_5xx` H5xx=`parse_url ${i} ${SVNAME} hrsp_5xx`
Hoxx=`parse_url ${i} ${SVNAME} hrsp_other` Hother=`parse_url ${i} ${SVNAME} hrsp_other`
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H1xx" echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H1xx"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H2xx" echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H2xx"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H3xx" echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H3xx"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H4xx" echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H4xx"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H5xx" echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H5xx"
echo "hrsp_oxx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hoxx" echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hother"
done done

View file

@ -13,7 +13,10 @@ haproxy_sessions_backend -Haproxy Sessions Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
@ -63,6 +73,7 @@ function parse_url {
SVNAME='BACKEND' SVNAME='BACKEND'
LIST="$backend" LIST="$backend"
WARN_PERCENT="80"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
@ -95,6 +106,14 @@ if [ "$1" = "config" ]; then
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE" echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0" echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit Sessions $i" echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit Sessions $i"
SLIM=`parse_url ${i} ${SVNAME} slim`
if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $SLIM"
fi
if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${SLIM}*${WARN_PERCENT}/100))"
fi
done done
exit 0 exit 0

View file

@ -13,7 +13,10 @@ haproxy_sessions_frontend -Haproxy Sessions Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);
@ -63,6 +73,7 @@ function parse_url {
SVNAME='FRONTEND' SVNAME='FRONTEND'
LIST="$frontend" LIST="$frontend"
WARN_PERCENT="80"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
@ -95,6 +106,14 @@ if [ "$1" = "config" ]; then
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE" echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0" echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit Sessions $i" echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit Sessions $i"
SLIM=`parse_url ${i} ${SVNAME} slim`
if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.critical $SLIM"
fi
if [[ "$SLIM" =~ ^[0-9]+$ ]] && [[ "$SLIM" != 0 ]]; then
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.warning $((${SLIM}*${WARN_PERCENT}/100))"
fi
done done
exit 0 exit 0

View file

@ -13,7 +13,10 @@ haproxy_sessions_total_frontend -Haproxy Sessions Total Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haprxoy_sessions_total_frontend -Haproxy Sessions Total Frontend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);

View file

@ -13,7 +13,10 @@ haproxy_warnings_backend -Haproxy Warnings Backend
user root user root
env.backend backend_name_1 backend_name_2 backend_name_3 env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3 env.frontend frontend_name_1 frontend_name_2 frontend_name_3
# You can use url o socket option, use one of them, not both!
env.url http://user:passwd@IP:port/admin?stats;csv env.url http://user:passwd@IP:port/admin?stats;csv
# or
env.socket /var/lib/haproxy/stats.socket
=head1 AUTHOR =head1 AUTHOR
@ -39,9 +42,16 @@ function parse_url {
PXNAME="$1" PXNAME="$1"
SVNAME="$2" SVNAME="$2"
VALUE="$3" VALUE="$3"
if [ ! -z "$url" ]; then
LINE1=`curl -s "$url" | head -1 | sed 's/# //'` LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"` LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
fi
if [ ! -z "$socket" ]; then
LINE1=`echo 'show stat' | socat unix-connect:"$socket" stdio | head -1 | sed 's/# //'`
LINE2=`echo 'show stat' | socat unix-connect:"$socket" stdio | grep "$PXNAME,$SVNAME"`
fi
ARRAY1=($LINE1); ARRAY1=($LINE1);