]> git.somenet.org - root/munin.git/blob - irccomp
changed ircd stat plugins
[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 NETIDLIST="sno otu"
20
21 if [ "$1" = "autoconf" ]; then
22         echo "yes"
23         exit 0
24 fi
25
26 if [ "$1" = "config" ]; then
27     echo "graph_title ircnet comparison"
28     echo "graph_info This graph compares IRC Networks"
29     echo "graph_category irc"
30     echo "graph_printf %.0lf"
31     echo "graph_scale no"
32     echo "graph_args -l 0"
33
34     for net in $NETIDLIST; do
35       echo "channels_${net}.label ${net}:channels"
36       echo "channels_${net}.draw LINE2"
37       echo "users_${net}.label ${net}:clients"
38       echo "users_${net}.draw LINE2"
39       echo "servers_${net}.label ${net}:servers"
40       echo "servers_${net}.draw LINE2"
41     done
42     exit 0
43 fi
44
45 for net in $NETIDLIST; do
46    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~'
47    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~'
48    grep -i "channels" /tmp/irc_${net}/lusers.txt 2>/dev/null | sed -E 's~^([0-9]+).*$~channels_'${net}'.value \1~'
49 done
50
51 exit 0