]> git.sven.stormbind.net Git - sven/scripts.git/blob - stormbind/munin/nullmailer_mailqueue
munin nullmailer mailque plugin
[sven/scripts.git] / stormbind / munin / nullmailer_mailqueue
1 #!/bin/sh
2 # -*- sh -*-
3
4 : << =cut
5
6 =head1 NAME
7
8 nullmailer_mailqueue - Plugin to graph the nullmailer queue size
9
10 =head1 CONFIGURATION
11
12 This plugin uses the following configuration variables
13
14  [nullmailer_mailqueue]
15   env.queuecmd - mailq command to execute
16
17 =head2 DEFAULT CONFIGURATION
18
19 The default configuration is
20
21  [nullmailer_mailqueue]
22   env.mtaqueue /usr/bin/mailq
23
24 =head1 AUTHOR
25
26 Sven Hoexter
27
28 =head1 LICENSE
29
30 GPLv2
31
32 =head1 MAGIC MARKERS
33
34  #%# family=auto
35  #%# capabilities=autoconf
36
37 =cut
38 QUEUECMD=${queuecmd:-/usr/bin/mailq}
39
40 if [ "$1" = "autoconf" ]; then
41         if [ -x "$QUEUECMD" ] ; then
42                 echo yes
43                 exit 0
44         else
45                 echo "no (queue command ${QUEUECMD} not found)"
46                 exit 0
47         fi
48 fi
49
50 if [ "$1" = "config" ]; then
51
52         echo 'graph_title nullmailer queued mails'
53         echo 'graph_order mails'
54         echo 'graph_vlabel mails in queue'
55         echo 'graph_category nullmailer'
56         echo 'mails.label mails'
57         exit 0
58 fi
59
60 mtamails=$(${QUEUECMD} | grep -Ec '[0-9]{4}')
61 echo "mails.value ${mtamails}"