More munin stuff
[freeradius.git] / scripts / freeradius.acct.munin
1 #!/bin/sh
2 #
3 # Plugin to count the daily amount of freeradius authentication packets.
4 #
5 # Written by Alan DeKok <aland@freeradius.org>
6 #
7 # Magic markers - optional - used by installation scripts and
8 # munin-config:
9 #
10 #%# family=manual
11 #%# capabilities=autoconf
12
13 RADMIN=radmin
14 SOCKETFILE=/var/run/radiusd/radiusd.sock
15
16 if [ "$1" = "autoconf" ]; then
17     #
18     #  FIXME: Check if FreeRADIUS is running.
19     #
20     echo yes
21     exit 0
22 fi
23
24 if [ "$1" = "config" ]; then
25     echo 'graph_title FreeRADIUS Accounting Requests'
26     echo 'graph_args --base 1000 -l 0 '
27     echo 'graph_period second'
28     echo 'graph_vlabel requests / ${graph_period}'
29     echo 'graph_category Other'
30
31     echo 'requests.label Accounting-Requests'
32     echo 'requests.info total incoming request packets'
33     echo 'requests.type DERIVE'
34     echo 'requests.min 0'
35
36     echo 'responses.label Accounting-Responses'
37     echo 'responses.info total outgoing response packets'
38     echo 'responses.type DERIVE'
39     echo 'responses.min 0'
40
41     echo 'dup.label Duplicate requests'
42     echo 'dup.info total duplicate request packets'
43     echo 'dup.type DERIVE'
44     echo 'dup.min 0'
45
46     echo 'invalid.label Invalid requests'
47     echo 'invalid.info total invalid request packets'
48     echo 'invalid.type DERIVE'
49     echo 'invalid.min 0'
50
51     echo 'malformed.label Malformed requests'
52     echo 'malformed.info total malformed request packets'
53     echo 'malformed.type DERIVE'
54     echo 'malformed.min 0'
55
56     echo 'bad_signature.label Requests with bad signature'
57     echo 'bad_signature.info total request packets with a bad signature'
58     echo 'bad_signature.type DERIVE'
59     echo 'bad_signature.min 0'
60
61     echo 'dropped.label Dropped requests'
62     echo 'dropped.info total request packets dropped for other reasons'
63     echo 'dropped.type DERIVE'
64     echo 'dropped.min 0'
65
66     echo 'unknown_types.label Unknown type'
67     echo 'unknown_types.info total request packets of unknown type'
68     echo 'unknown_types.type DERIVE'
69     echo 'unknown_types.min 0'
70
71     exit 0
72 fi
73
74 $RADMIN -f $SOCKETFILE -e "stats client acct" | awk '{print $1".value " $2}'