plugin-greylistd_stats: greylistd_stats

File greylistd_stats, 2.2 kB (added by Michael Mende <debian AT menole DOT net>, 4 years ago)

plugin

Line 
1 #!/bin/sh
2 #
3 # Plugin to monitor greylistd statistics.
4 #
5 # Author: Michael Mende <debian@menole.net>
6 #
7 # Usage: Place in /etc/munin/plugins/ (or link it there  using ln -s)
8 #
9 # Config variables:
10 #
11 #       greylist - path to greylist command
12 #
13 # Parameters understood:
14 #
15 #       config   (required)
16 #       autoconf (optional)
17 #
18 # Permissions:
19 #       please ensure that the user running munin-node has the right to access the
20 #       greylistd socket.
21 #
22 #       Add these lines into your /etc/munin/plugin-conf.d/munin-node
23 #       [greylistd_stats]
24 #       user greylist
25 #       group greylist
26 #
27 #
28 # Magic markers (used by munin-node-configure)
29 #%# capabilities=autoconf
30 #%# family=auto
31
32 if [ -n "$greylist" ]; then GREYLIST=$greylist; else GREYLIST=`which greylist`; fi
33
34 if [ "$1" = "autoconf" ]; then
35         if [ -n "$GREYLIST" ] && [ -x "$GREYLIST" ]; then
36                 echo yes
37                 exit 0
38         else
39                 echo "no (no greylist command)"
40                 exit 1
41         fi
42 fi
43
44 if [ "$1" = "config" ]; then
45
46         echo "graph_title greylistd statistics"
47         echo "graph_order whitelisteditems whitelistedrequests blacklisteditems \
48 blacklistedrequests greylisteditems greylistedrequests"
49         echo 'graph_vlabel requests / items'
50         echo "graph_category greylistd"
51
52         echo "greylistedrequests.label grey requests"
53         echo "greylistedrequests.max 1000000"
54         echo "greylistedrequests.min 0"
55         echo "greylistedrequests.type GAUGE"
56
57         echo "greylisteditems.label grey items"
58         echo "greylisteditems.max 1000000"
59         echo "greylisteditems.min 0"
60         echo "greylisteditems.type GAUGE"
61
62         echo "blacklistedrequests.label black requests"
63         echo "blacklistedrequests.max 1000000"
64         echo "blacklistedrequests.min 0"
65         echo "blacklistedrequests.type GAUGE"
66
67         echo "blacklisteditems.label black items"
68         echo "blacklisteditems.max 1000000"
69         echo "blacklisteditems.min 0"
70         echo "blacklisteditems.type GAUGE"
71
72         echo "whitelistedrequests.label white requests"
73         echo "whitelistedrequests.max 1000000"
74         echo "whitelistedrequests.min 0"
75         echo "whitelistedrequests.type GAUGE"
76
77     echo "whitelisteditems.label white items"
78     echo "whitelisteditems.max 1000000"
79     echo "whitelisteditems.min 0"
80     echo "whitelisteditems.type GAUGE"
81         exit 0
82 fi
83
84 $GREYLIST stats | awk '/requests, are currently (white|black|grey)listed$/ {
85         res[$8$2] = $1
86         res[$8$5] = $4
87 }
88 END {
89         for (var in res)
90                 print substr(var,0,length(var))".value "res[var]
91 }'