]> git.somenet.org - somenet/munin.git/blob - irccomp
hostapd stats script
[somenet/munin.git] / irccomp
1 #!/bin/sh
2
3 NETIDLIST="sno fro otu"
4
5 if [ "$1" = "autoconf" ]; then
6         echo "yes"
7         exit 0
8 fi
9
10 if [ "$1" = "config" ]; then
11     echo "graph_title ircnet comparison"
12     echo "graph_info This graph compares IRC Networks"
13     echo "graph_category irc"
14     echo "graph_printf %.0lf"
15     echo "graph_scale no"
16     echo "graph_args -l 0"
17
18     for net in $NETIDLIST; do
19       echo "channels_${net}.label ${net}:channels"
20       echo "channels_${net}.draw LINE2"
21       echo "users_${net}.label ${net}:clients"
22       echo "users_${net}.draw LINE2"
23       echo "servers_${net}.label ${net}:servers"
24       echo "servers_${net}.draw LINE2"
25     done
26     exit 0
27 fi
28
29 for net in $NETIDLIST; do
30    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~'
31    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~'
32    grep -i "channels" /tmp/irc_${net}_lusers.txt 2>/dev/null | sed -E 's~^([0-9]+).*$~channels_'${net}'.value \1~'
33 done
34
35 exit 0