]> git.somenet.org - somenet/munin.git/blob - hostap
hostapd stats script
[somenet/munin.git] / hostap
1 #!/bin/sh
2
3 if [ "$1" = "autoconf" ]; then
4         echo "yes"
5         exit 0
6 fi
7
8 if [ "$1" = "config" ]; then
9     echo "graph_title Hostapd status"
10     echo "graph_info This graph shows the status of stations connected to the wlan."
11     echo "graph_category hostapd"
12     echo "graph_order numsta numstanonerp numstanoshortslottime numstanoshortpreamble cauth cassoc cauthorized"
13     echo "graph_printf %.0lf"
14     echo "graph_scale no"
15     echo "graph_args -l 0"
16     echo "numsta.label Number of all stations"
17     echo "numsta.draw LINE2"
18     echo "numstanonerp.label Non-erp stations"
19     echo "numstanonerp.draw LINE2"
20     echo "numstanoshortslottime.label Non-short-slot-time stations"
21     echo "numstanoshortslottime.draw LINE2"
22     echo "numstanoshortpreamble.label Non-short-preamble stations"
23     echo "numstanoshortpreamble.draw LINE2"
24     echo "cauth.label Clients auth"
25     echo "cauth.draw LINE2"
26     echo "cassoc.label Clients assoc"
27     echo "cassoc.draw LINE2"
28     echo "cauthorized.label Clients authorized"
29     echo "cauthorized.draw LINE2"
30     exit 0
31 fi
32
33 killall -SIGUSR1 hostapd &> /dev/null
34
35 head -n3 /tmp/hostapd.dump | tail -n2 | sed -e 's/ /\n/g' -e 's/_//g' -e 's/=/.value /g'
36 echo "cauth.value $(grep '\[AUTH\]' /tmp/hostapd.dump | wc -l)"
37 echo "cassoc.value $(grep '\[ASSOC\]' /tmp/hostapd.dump | wc -l)"
38 echo "cauthorized.value $(grep '\[AUTHORIZED\]' /tmp/hostapd.dump | wc -l)"
39
40 exit 0