From: Sven Hoexter Date: Fri, 7 May 2021 07:53:37 +0000 (+0200) Subject: munin nullmailer mailque plugin X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=0c34de1372ae241390ce6ca2f90ac4490ead1b9b;p=sven%2Fscripts.git munin nullmailer mailque plugin --- diff --git a/stormbind/munin/nullmailer_mailqueue b/stormbind/munin/nullmailer_mailqueue new file mode 100755 index 0000000..a46fc6c --- /dev/null +++ b/stormbind/munin/nullmailer_mailqueue @@ -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}"