From 0c34de1372ae241390ce6ca2f90ac4490ead1b9b Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Fri, 7 May 2021 09:53:37 +0200 Subject: [PATCH] munin nullmailer mailque plugin --- stormbind/munin/nullmailer_mailqueue | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 stormbind/munin/nullmailer_mailqueue 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}" -- 2.39.5