]> git.somenet.org - somenet/munin.git/blob - hostap
done a public stats plugin and removed all the others
[somenet/munin.git] / hostap
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 if [ "$1" = "autoconf" ]; then
20         echo "yes"
21         exit 0
22 fi
23
24 if [ "$1" = "config" ]; then
25     echo "graph_title Hostapd status"
26     echo "graph_info This graph shows the status of stations connected to the wlan."
27     echo "graph_category hostapd"
28 #    echo "graph_order numsta numstanonerp numstanoshortslottime numstanoshortpreamble cauth cassoc cauthorized cshopre cwmm"
29     echo "graph_printf %.0lf"
30     echo "graph_scale no"
31     echo "graph_args -l 0"
32     echo "numsta.label Number of all stations"
33     echo "numsta.draw LINE2"
34     echo "numstanonerp.label Non-erp stations"
35     echo "numstanonerp.draw LINE2"
36     echo "numstanoshortslottime.label Non-short-slot-time stations"
37     echo "numstanoshortslottime.draw LINE2"
38     echo "numstanoshortpreamble.label Non-short-preamble stations"
39     echo "numstanoshortpreamble.draw LINE2"
40     echo "cauth.label Clients AUTH"
41     echo "cauth.draw LINE2"
42     echo "cassoc.label Clients ASSOC"
43     echo "cassoc.draw LINE2"
44     echo "cauthorized.label Clients AUTHORIZED"
45     echo "cauthorized.draw LINE2"
46     echo "cshopre.label Clients SHORT_PREAMBLE"
47     echo "cshopre.draw LINE2"
48     echo "cwmm.label Clients WMM"
49     echo "cwmm.draw LINE2"
50     echo "cps.label Clients PS"
51     echo "cps.draw LINE2"
52     echo "ctim.label Clients TIM"
53     echo "ctim.draw LINE2"
54     echo "cperm.label Clients PERM"
55     echo "cperm.draw LINE2"
56     echo "cwds.label Clients WDS"
57     echo "cwds.draw LINE2"
58     echo "cwps.label Clients WPS"
59     echo "cwps.draw LINE2"
60     echo "cwps2.label Clients WPS2"
61     echo "cwps2.draw LINE2"
62     echo "cpp.label Clients PENDING_POLL"
63     echo "cpp.draw LINE2"
64     echo "cmfp.label Clients MFP"
65     echo "cmfp.draw LINE2"
66     echo "cmwps.label Clients MAYBE_WPS"
67     echo "cmwps.draw LINE2"
68     echo "cpreauth.label Clients PREAUTH"
69     echo "cpreauth.draw LINE2"
70     echo "cnonerp.label Clients NonERP"
71     echo "cnonero.draw LINE2"
72     exit 0
73 fi
74
75 killall -SIGUSR1 hostapd &> /dev/null
76
77 head -n3 /tmp/hostapd.dump | tail -n2 | sed -e 's/ /\n/g' -e 's/_//g' -e 's/=/.value /g'
78 echo "cauth.value $(grep '\[AUTH\]' /tmp/hostapd.dump | wc -l)"
79 echo "cassoc.value $(grep '\[ASSOC\]' /tmp/hostapd.dump | wc -l)"
80 echo "cauthorized.value $(grep '\[AUTHORIZED\]' /tmp/hostapd.dump | wc -l)"
81 echo "cshopre.value $(grep '\[SHORT_PREAMBLE\]' /tmp/hostapd.dump | wc -l)"
82 echo "cwmm.value $(grep '\[WMM\]' /tmp/hostapd.dump | wc -l)"
83 echo "cps.value $(grep '\[PS\]' /tmp/hostapd.dump | wc -l)"
84 echo "ctim.value $(grep '\[TIM\]' /tmp/hostapd.dump | wc -l)"
85 echo "cperm.value $(grep '\[PERM\]' /tmp/hostapd.dump | wc -l)"
86 echo "cwps.value $(grep '\[WPS\]' /tmp/hostapd.dump | wc -l)"
87 echo "cwps2.value $(grep '\[WPS2\]' /tmp/hostapd.dump | wc -l)"
88 echo "cwds.value $(grep '\[WDS\]' /tmp/hostapd.dump | wc -l)"
89 echo "cpp.value $(grep '\[PENDING_POLL\]' /tmp/hostapd.dump | wc -l)"
90 echo "cmfp.value $(grep '\[MFP\]' /tmp/hostapd.dump | wc -l)"
91 echo "cmwps.value $(grep '\[MAYBE_WPS\]' /tmp/hostapd.dump | wc -l)"
92 echo "cpreauth.value $(grep '\[PREAUTH\]' /tmp/hostapd.dump | wc -l)"
93 echo "cnonerp.value $(grep '\[NonERP\]' /tmp/hostapd.dump | wc -l)"
94
95 exit 0
96