]> git.sven.stormbind.net Git - sven/scripts.git/commitdiff
munin nullmailer mailque plugin
authorSven Hoexter <sven@stormbind.net>
Fri, 7 May 2021 07:53:37 +0000 (09:53 +0200)
committerSven Hoexter <sven@stormbind.net>
Fri, 7 May 2021 08:40:01 +0000 (10:40 +0200)
stormbind/munin/nullmailer_mailqueue [new file with mode: 0755]

diff --git a/stormbind/munin/nullmailer_mailqueue b/stormbind/munin/nullmailer_mailqueue
new file mode 100755 (executable)
index 0000000..a46fc6c
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+# -*- sh -*-
+
+: << =cut
+
+=head1 NAME
+
+nullmailer_mailqueue - Plugin to graph the nullmailer queue size
+
+=head1 CONFIGURATION
+
+This plugin uses the following configuration variables
+
+ [nullmailer_mailqueue]
+  env.queuecmd - mailq command to execute
+
+=head2 DEFAULT CONFIGURATION
+
+The default configuration is
+
+ [nullmailer_mailqueue]
+  env.mtaqueue /usr/bin/mailq
+
+=head1 AUTHOR
+
+Sven Hoexter
+
+=head1 LICENSE
+
+GPLv2
+
+=head1 MAGIC MARKERS
+
+ #%# family=auto
+ #%# capabilities=autoconf
+
+=cut
+QUEUECMD=${queuecmd:-/usr/bin/mailq}
+
+if [ "$1" = "autoconf" ]; then
+       if [ -x "$QUEUECMD" ] ; then
+               echo yes
+               exit 0
+       else
+               echo "no (queue command ${QUEUECMD} not found)"
+               exit 0
+       fi
+fi
+
+if [ "$1" = "config" ]; then
+
+       echo 'graph_title nullmailer queued mails'
+       echo 'graph_order mails'
+       echo 'graph_vlabel mails in queue'
+       echo 'graph_category nullmailer'
+       echo 'mails.label mails'
+       exit 0
+fi
+
+mtamails=$(${QUEUECMD} | grep -Ec '[0-9]{4}')
+echo "mails.value ${mtamails}"