]> git.somenet.org - root/munin.git/blob - irccomp_
made irccompare a wildcard virtual plugin.
[root/munin.git] / irccomp_
1 #!/bin/sh
2 #
3 # Copyright 2011 by Jan Vales <jan@jvales.net> (Someone <someone@somenet.org>)
4 #
5 #    This program is free software: you can redistribute it and/or modify
6 #    it under the terms of the GNU General Public License as published by
7 #    the Free Software Foundation, version 3 of the License.
8 #
9 #    This program is distributed in the hope that it will be useful,
10 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #    GNU General Public License for more details.
13 #
14 #    You should have received a copy of the GNU General Public License
15 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17
18
19 IRCNET=${0##*irccomp_}
20 NETIDLIST=$(echo ${IRCNET} | sed -e 's/_/ /g')
21
22 if [ "$1" = "autoconf" ]; then
23         echo "yes"
24         exit 0
25 fi
26
27 if [ "$1" = "config" ]; then
28     echo "graph_title An IRC-Net comparison of $NETIDLIST"
29     echo "graph_info This VIRTUAL plugin compares IRC Networks"
30     echo "graph_category irc"
31     echo "update no"
32     echo "graph yes"
33     echo "graph_printf %.0lf"
34     echo "graph_scale no"
35     echo "graph_args -l 0"
36
37         GORDER="graph_order"
38     for net in $NETIDLIST; do
39                 GORDER="${GORDER} ch_${net}=10;srv253:ircdlusers_${net}.channels"
40                 GORDER="${GORDER} clt_${net}=10;srv253:ircdlusers_${net}.clients"
41                 GORDER="${GORDER} srv_${net}=10;srv253:ircdlusers_${net}.servers"
42     done
43
44         echo $GORDER
45
46     for net in $NETIDLIST; do
47       echo "ch_${net}.label ${net}:channels"
48       echo "ch_${net}.draw LINE2"
49       echo "clt_${net}.label ${net}:clients"
50       echo "clt_${net}.draw LINE2"
51       echo "srv_${net}.label ${net}:servers"
52       echo "srv_${net}.draw LINE2"
53     done
54     exit 0
55 fi
56
57 #for net in $NETIDLIST; do
58 #   grep -i "There are" /tmp/irc_${net}/lusers.txt 2>/dev/null | sed -E 's~^There are .*? on ([0-9]+) servers.*$~servers_'${net}'.value \1~'
59 #   grep -i "Current Global Users" /tmp/irc_${net}/lusers.txt 2>/dev/null | sed -E 's~^Current Global Users: ([0-9]+) .*$~users_'${net}'.value \1~'
60 #   grep -i "channels" /tmp/irc_${net}/lusers.txt 2>/dev/null | sed -E 's~^([0-9]+).*$~channels_'${net}'.value \1~'
61 #done
62
63 exit 0
64