2012-10-22 12:32:51 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# -*- bash -*-
|
|
|
|
|
|
|
|
: << =cut
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2013-06-17 12:59:32 +02:00
|
|
|
ipvs_conn -Indicate the number of conections per second
|
2012-10-22 12:32:51 +02:00
|
|
|
|
|
|
|
=head1 CONFIGURATION
|
|
|
|
|
|
|
|
[ipvs_*]
|
|
|
|
user root
|
|
|
|
env.ips IP1 IP2
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
Ricardo Fraile <rfrail3@yahoo.es>
|
|
|
|
|
|
|
|
=head1 LICENSE
|
|
|
|
|
|
|
|
GPLv2
|
|
|
|
|
|
|
|
=head1 MAGICK MARKERS
|
|
|
|
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
. $MUNIN_LIBDIR/plugins/plugin.sh
|
|
|
|
|
|
|
|
|
|
|
|
IPLIST=$ips
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
2013-06-17 12:59:32 +02:00
|
|
|
echo 'graph_title Ipvs connections per second'
|
2012-10-22 12:32:51 +02:00
|
|
|
echo 'graph_args --base 1000 -l 0 '
|
|
|
|
echo 'graph_vlabel Connections'
|
|
|
|
echo 'graph_scale no'
|
2017-02-22 05:34:14 +01:00
|
|
|
echo 'graph_category loadbalancer'
|
2012-10-22 12:32:51 +02:00
|
|
|
echo 'graph_info Indicate the number of connections per second.'
|
|
|
|
|
|
|
|
for IP in $IPLIST; do
|
|
|
|
NM=`echo $IP | md5sum | cut -d - -f1 | sed 's/ //g' | cut -b 5-9`
|
|
|
|
echo "a$NM.label $IP Connections"
|
|
|
|
echo "a$NM.type GAUGE"
|
|
|
|
echo "a$NM.min 0"
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
F1=`mktemp`
|
|
|
|
ipvsadm -l -n --rate| nl > $F1
|
|
|
|
|
|
|
|
for IP in $IPLIST; do
|
|
|
|
|
2013-06-17 12:09:53 +02:00
|
|
|
COUNT=`cat $F1 | grep -e TCP -e UDP | grep $IP | awk '{print $4}'`
|
2012-10-22 12:32:51 +02:00
|
|
|
NM=`echo $IP | md5sum | cut -d - -f1 | sed 's/ //g' | cut -b 5-9`
|
|
|
|
echo a$NM.value $COUNT
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
# Remove temp file
|
|
|
|
rm -f $F1
|