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

Merge pull request #183 from rfrail3/master

Haproxy monitor plugin
This commit is contained in:
Steve Schnepp 2012-09-15 05:08:33 -07:00
commit 97dd02a720
19 changed files with 2069 additions and 0 deletions

View File

@ -0,0 +1,106 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_aborts_backend -Haproxy Aborts Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST="$backend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Aborts ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Aborts'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Aborts ${SVNAME}"
for i in ${LIST}; do
echo "cli_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Aborted by client $i"
echo "cli_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "cli_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "cli_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Data transfers aborted by the client $i"
echo "srv_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Aborted by server $i"
echo "srv_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "srv_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "srv_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Data transfers aborted by the server $i"
done
exit 0
fi
for i in ${LIST}; do
CLI=`parse_url ${i} ${SVNAME} cli_abrt`
SRV=`parse_url ${i} ${SVNAME} srv_abrt`
echo "cli_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $CLI"
echo "srv_abrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SRV"
done

View File

@ -0,0 +1,93 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_active_backend -Haproxy servers active backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST=$backend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Active Servers ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Servers'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Active Servers ${SVNAME}"
for i in ${LIST}; do
echo "act`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Active Servers $i"
echo "act`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "act`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "act`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Active Servers $i"
done
exit 0
fi
for i in ${LIST}; do
ACT=`parse_url ${i} ${SVNAME} act`
echo "act`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $ACT"
done

View File

@ -0,0 +1,104 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_bytes_backend -Haproxy Bytes Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST=$backend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Bytes ${SVNAME}"
echo 'graph_args --base 1000'
echo 'graph_vlabel Bytes in (-) / out (+)'
echo 'graph_category haproxy'
echo "graph_info Bytes ${SVNAME}"
for i in ${LIST}; do
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Bytes $i"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.graph no"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.cdef down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`,8,*"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Bytes $i"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.negative down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.cdef up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`,8,*"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Bytes in $i"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
done
exit 0
fi
for i in ${LIST}; do
BIN=`parse_url ${i} ${SVNAME} bin`
BOUT=`parse_url ${i} ${SVNAME} bout`
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $BOUT"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $BIN"
done

View File

@ -0,0 +1,104 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_bytes_frontend -Haproxy Bytes Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST=$frontend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Bytes ${SVNAME}"
echo 'graph_args --base 1000'
echo 'graph_vlabel Bytes in (-) / out (+)'
echo 'graph_category haproxy'
echo "graph_info Bytes ${SVNAME}"
for i in ${LIST}; do
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Bytes $i"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.graph no"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.cdef down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`,8,*"
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Bytes $i"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.negative down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.cdef up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`,8,*"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Bytes in $i"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
done
exit 0
fi
for i in ${LIST}; do
BIN=`parse_url ${i} ${SVNAME} bin`
BOUT=`parse_url ${i} ${SVNAME} bout`
echo "down`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $BOUT"
echo "up`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $BIN"
done

View File

@ -0,0 +1,105 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_denied_backend -Haproxy Denied Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST="$backend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Denied Requests / Responses ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Requests and Responses'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Denied Requests / Responses ${SVNAME}"
for i in ${LIST}; do
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Denied Requests $i"
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Denied Requests $i"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Denied Responses $i"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Denied Responses $i"
done
exit 0
fi
for i in ${LIST}; do
DREQ=`parse_url ${i} ${SVNAME} dreq`
DRESP=`parse_url ${i} ${SVNAME} dresp`
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $DREQ"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $DRESP"
done

View File

@ -0,0 +1,105 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_denied_frontend -Haproxy Denied Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST="$frontend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Denied Requests / Responses ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Requests and Responses'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Denied Requests / Responses ${SVNAME}"
for i in ${LIST}; do
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Denied Requests $i"
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Denied Requests $i"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Denied Responses $i"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Denied Responses $i"
done
exit 0
fi
for i in ${LIST}; do
DREQ=`parse_url ${i} ${SVNAME} dreq`
DRESP=`parse_url ${i} ${SVNAME} dresp`
echo "dreq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $DREQ"
echo "dresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $DRESP"
done

View File

@ -0,0 +1,113 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_errors_backend -Haproxy Errors Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST="$backend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Errors ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Errors'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Errors ${SVNAME}"
for i in ${LIST}; do
#echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Request Errors $i"
#echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
#echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Request Errors $i"
echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Connection Errors $i"
echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Connection Errors $i"
echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Response Errors $i"
echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Response Errors $i"
done
exit 0
fi
for i in ${LIST}; do
#EREQ=`parse_url ${i} ${SVNAME} ereq`
ECON=`parse_url ${i} ${SVNAME} econ`
ERESP=`parse_url ${i} ${SVNAME} eresp`
#echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $EREQ"
echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $ECON"
echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $ERESP"
done

View File

@ -0,0 +1,113 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_errors_frontend -Haproxy Errors Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST="$frontend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Errors ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Errors'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Errors ${SVNAME}"
for i in ${LIST}; do
echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Request Errors $i"
echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Request Errors $i"
#echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Connection Errors $i"
#echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
#echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Connection Errors $i"
#echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Response Errors $i"
#echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
#echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Response Errors $i"
done
exit 0
fi
for i in ${LIST}; do
EREQ=`parse_url ${i} ${SVNAME} ereq`
#ECON=`parse_url ${i} ${SVNAME} econ`
#ERESP=`parse_url ${i} ${SVNAME} eresp`
echo "ereq`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $EREQ"
#echo "econ`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $ECON"
#echo "eresp`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $ERESP"
done

View File

@ -0,0 +1,106 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_queue_backend -Haproxy Queued Requests Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST=$backend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Queued Request ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Queued'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Queue Requests ${SVNAME}"
for i in ${LIST}; do
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Current queued request $i"
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Current queued request $i"
#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Max $i"
#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'`.info Max queued request $i"
done
exit 0
fi
for i in ${LIST}; do
QCUR=`parse_url ${i} ${SVNAME} qcur`
#QMAX=`parse_url ${i} ${SVNAME} qmax`
echo "qcur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QCUR"
#echo "qmax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $QMAX"
done

View File

@ -0,0 +1,112 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_rate_backend -Haproxy Sessions Per Second Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST=$backend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Sessions per second ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Sessions'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Sessions per second ${SVNAME}"
for i in ${LIST}; do
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Rate $i"
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Number of sessions per second over last elapsed second $i"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Limit $i"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit on new sessions per second $i"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Max $i"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
#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"
done
exit 0
fi
for i in ${LIST}; do
RATE=`parse_url ${i} ${SVNAME} rate`
RATEL=`parse_url ${i} ${SVNAME} rate_lim`
#RATEM=`parse_url ${i} ${SVNAME} rate_max`
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $RATE"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $RATEL"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $RATEM"
done

View File

@ -0,0 +1,113 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
harpoxy_rate_frontend -Haproxy Sessions Per Second Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST=$frontend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Sessions per sencond ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Sessions'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Sessions per second ${SVNAME}"
for i in ${LIST}; do
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Rate $i"
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Number of sessions per second over last elapsed second $i"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Limit $i"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Limit on new sessions per second $i"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Max $i"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
#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"
done
exit 0
fi
for i in ${LIST}; do
RATE=`parse_url ${i} ${SVNAME} rate`
RATEL=`parse_url ${i} ${SVNAME} rate_lim`
#RATEM=`parse_url ${i} ${SVNAME} rate_max`
echo "rate`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $RATE"
echo "rate_lim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $RATEL"
#echo "rate_max`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $RATEM"
done

View File

@ -0,0 +1,106 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_reqrate_frontend -Haproxy request rate frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST="$frontend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Request Rate ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Requests'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Request Rate ${SVNAME}"
for i in ${LIST}; do
echo "reqrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Requests per second $i"
echo "reqrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "reqrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "reqrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP requests per second over last elapsed second $i"
#echo "reqrtm`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Max $i"
#echo "reqrtm`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
#echo "reqrtm`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "reqrtm`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info max number of HTTP requests per second observed $i"
done
exit 0
fi
for i in ${LIST}; do
REQRT=`parse_url ${i} ${SVNAME} req_rate`
#REQRTM=`parse_url ${i} ${SVNAME} req_rate_max`
echo "reqrt`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $REQRT"
#echo "reqtm`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $REQRTM"
done

View File

@ -0,0 +1,130 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_responses_backend -Haproxy responses backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rikr_@hotmail.com>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modificamos la variable if, al final se vuelve a dejar igual
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Recorremos el array buscando los valores esperados
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Si coincide con el valor, sacar el dato
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# se deja la variable igual
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST=$backend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title HTTP Responses ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Responses'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info HTTP Responses ${SVNAME}"
for i in ${LIST}; do
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 1xx $i"
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 1xx code $i"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 2xx $i"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 2xx code $i"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 3xx $i"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 3xx code $i"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 4xx $i"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 4xx code $i"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 5xx $i"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 5xx code $i"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP other $i"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with other codes $i"
done
exit 0
fi
for i in ${LIST}; do
H1xx=`parse_url ${i} ${SVNAME} hrsp_1xx`
H2xx=`parse_url ${i} ${SVNAME} hrsp_2xx`
H3xx=`parse_url ${i} ${SVNAME} hrsp_3xx`
H4xx=`parse_url ${i} ${SVNAME} hrsp_4xx`
H5xx=`parse_url ${i} ${SVNAME} hrsp_5xx`
Hoxx=`parse_url ${i} ${SVNAME} hrsp_other`
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_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_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $H5xx"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $Hoxx"
done

View File

@ -0,0 +1,130 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_responses_frontend -Haproxy responses frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST=$frontend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title HTTP Responses ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Responses'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info HTTP Responses ${SVNAME}"
for i in ${LIST}; do
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 1xx $i"
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_1xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 1xx code $i"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 2xx $i"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_2xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 2xx code $i"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 3xx $i"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_3xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 3xx code $i"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 4xx $i"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_4xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 4xx code $i"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP 5xx $i"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_5xx`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with 5xx code $i"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label HTTP other $i"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "hrsp_other`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info HTTP responses with other codes $i"
done
exit 0
fi
for i in ${LIST}; do
H1xx=`parse_url ${i} ${SVNAME} hrsp_1xx`
H2xx=`parse_url ${i} ${SVNAME} hrsp_2xx`
H3xx=`parse_url ${i} ${SVNAME} hrsp_3xx`
H4xx=`parse_url ${i} ${SVNAME} hrsp_4xx`
H5xx=`parse_url ${i} ${SVNAME} hrsp_5xx`
Hoxx=`parse_url ${i} ${SVNAME} hrsp_other`
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_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_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"
done

View File

@ -0,0 +1,112 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_sessions_backend -Haproxy Sessions Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST="$backend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Current sessions ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Sessions'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Current sessions ${SVNAME}"
for i in ${LIST}; do
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Current Sessions $i"
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Current Sessions $i"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Max $i"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max sessions $i"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Limit Sessions $i"
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'`.info Limit Sessions $i"
done
exit 0
fi
for i in ${LIST}; do
SCUR=`parse_url ${i} ${SVNAME} scur`
#SMAX=`parse_url ${i} ${SVNAME} smax`
SLIM=`parse_url ${i} ${SVNAME} slim`
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SCUR"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SMAX"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SLIM"
done

View File

@ -0,0 +1,112 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_sessions_frontend -Haproxy Sessions Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST="$frontend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Current sessions ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Sessions'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Current sessions ${SVNAME}"
for i in ${LIST}; do
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Current Sessions $i"
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Current Sessions $i"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Max $i"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type GAUGE"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Max Sessions $i"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Limit Sessions $i"
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'`.info Limit Sessions $i"
done
exit 0
fi
for i in ${LIST}; do
SCUR=`parse_url ${i} ${SVNAME} scur`
#SMAX=`parse_url ${i} ${SVNAME} smax`
SLIM=`parse_url ${i} ${SVNAME} slim`
echo "scur`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SCUR"
#echo "smax`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SMAX"
echo "slim`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $SLIM"
done

View File

@ -0,0 +1,99 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_sessions_total_frontend -Haproxy Sessions Total Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST=$backend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Total sessions ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Sessions'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Total sessions ${SVNAME}"
for i in ${LIST}; do
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Total Sessions $i"
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Total Sessions $i"
done
exit 0
fi
for i in ${LIST}; do
STOT=`parse_url ${i} ${SVNAME} stot`
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $STOT"
done

View File

@ -0,0 +1,100 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haprxoy_sessions_total_frontend -Haproxy Sessions Total Frontend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='FRONTEND'
LIST=$frontend
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Total sessions ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Sessions'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Total sessions ${SVNAME}"
for i in ${LIST}; do
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Total Sessions $i"
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Total Sessions $i"
done
exit 0
fi
for i in ${LIST}; do
STOT=`parse_url ${i} ${SVNAME} stot`
echo "stot`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $STOT"
done

View File

@ -0,0 +1,106 @@
#!/bin/bash
# -*- bash -*-
: << =cut
=head1 NAME
haproxy_warnings_backend -Haproxy Warnings Backend
=head1 CONFIGURATION
[haproxy*]
user root
env.backend backend_name_1 backend_name_2 backend_name_3
env.frontend frontend_name_1 frontend_name_2 frontend_name_3
env.url http://user:passwd@IP:port/admin?stats;csv
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
function parse_url {
# Modify ifs variable
OIFS=$IFS;
IFS=",";
PXNAME="$1"
SVNAME="$2"
VALUE="$3"
LINE1=`curl -s "$url" | head -1 | sed 's/# //'`
LINE2=`curl -s "$url" | grep "$PXNAME,$SVNAME"`
ARRAY1=($LINE1);
# Find values
for ((i=0; i<${#ARRAY1[@]}; ++i));
do
# Get data
if [[ "${ARRAY1[$i]}" == "${VALUE}" ]]; then
o=$i;
o=`expr $o + 1`
echo ${LINE2} | cut -d" " -f $o
fi
done
# Reset ifs
IFS=$OIFS;
}
SVNAME='BACKEND'
LIST="$backend"
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Warnings ${SVNAME}"
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Warnings'
echo 'graph_scale no'
echo 'graph_category haproxy'
echo "graph_info Warnings ${SVNAME}"
for i in ${LIST}; do
echo "wretr`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Warning Retries $i"
echo "wretr`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "wretr`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "wretr`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Warning Retries $i"
echo "wredis`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.label Warning Redispatches $i"
echo "wredis`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.type DERIVE"
echo "wredis`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.min 0"
echo "wredis`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.info Warning Redispatches $i"
done
exit 0
fi
for i in ${LIST}; do
WRETR=`parse_url ${i} ${SVNAME} wretr`
WREDIS=`parse_url ${i} ${SVNAME} wredis`
echo "wretr`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $WRETR"
echo "wredis`echo $i | md5sum | cut -d - -f1 | sed 's/ //g'`.value $WREDIS"
done