Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / ipvs / ipvs_bps @ 430d68ff

Historique | Voir | Annoter | Télécharger (1,57 ko)

1 5e94465b rfrail3
#!/bin/bash
2
# -*- bash -*-
3
4
: << =cut
5
6
=head1 NAME
7
8
ipvs_conn -Indicate the number of bytes per second in ipvs
9
10
=head1 CONFIGURATION
11
12
[ipvs_*]
13
user root
14
env.ips IP1 IP2
15
16
=head1 AUTHOR
17
18
Ricardo Fraile <rfrail3@yahoo.es>
19
20
=head1 LICENSE
21
22
GPLv2
23
24
=head1 MAGICK MARKERS
25
26
 #%# family=auto
27
 #%# capabilities=autoconf
28
29
=cut
30
31
. $MUNIN_LIBDIR/plugins/plugin.sh
32
33
34
IPLIST=$ips
35
36
37
if [ "$1" = "autoconf" ]; then
38
        echo yes 
39
        exit 0
40
fi
41
42
if [ "$1" = "config" ]; then
43
44
        echo 'graph_title Ipvs Traffic'
45
        echo 'graph_args --base 1000 -l 0 '
46
	echo 'graph_vlabel Bytes in (-) / out (+)'
47
        echo 'graph_category Ipvs'
48
        echo 'graph_info Indicate the ipvs traffic.'
49
50
	for IP in $IPLIST; do
51
		NM=`echo $IP | md5sum | cut -d - -f1 | sed 's/ //g' | cut -b 5-9`
52
53
		echo "down$NM.label Bytes $IP"
54
                echo "down$NM.type GAUGE"
55
                echo "down$NM.graph no"
56
                echo "down$NM.cdef down$NM,8,*"
57
                echo "down$NM.min 0"
58
59
                echo "up$NM.label Bytes $IP"
60
                echo "up$NM.type GAUGE"
61
                echo "up$NM.negative down$NM"
62
                echo "up$NM.cdef up$NM,8,*"
63
                echo "up$NM.info Bytes in $i"
64
                echo "up$NM.min 0"
65
	done
66
67
        exit 0
68
fi
69
70
71
72
73
F1=`mktemp`
74
ipvsadm -l -n  --rate| nl > $F1
75
76
for IP in $IPLIST; do
77
78
	COUNT1=`cat $F1 | grep TCP | grep $IP  | awk '{print $7}'`
79
	COUNT2=`cat $F1 | grep TCP | grep $IP  | awk '{print $8}'`
80
	NM=`echo $IP | md5sum | cut -d - -f1 | sed 's/ //g' | cut -b 5-9`
81
	echo down$NM.value $COUNT1
82
	echo up$NM.value $COUNT2
83
84
done
85
86
# Remove temp file
87
rm -f $F1