From aa009f60930d24d5e43667abb8544789cd1093dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Arne=20Bj=C3=B8rndal?= Date: Wed, 28 Nov 2018 16:11:02 +0100 Subject: [PATCH 1/2] Add support for configurable thresholds to nullmailer_queue plugin --- plugins/mail/nullmailer_queue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/mail/nullmailer_queue b/plugins/mail/nullmailer_queue index 65806b88..a5028f3f 100755 --- a/plugins/mail/nullmailer_queue +++ b/plugins/mail/nullmailer_queue @@ -18,18 +18,22 @@ will need to run as that user or root. Additionally, the nullmailer queue directory may vary; in that case you can specify it with the "queuedir" and "errordir" environment variables. +To add extra warning or critical thresholds set queue_warning, +failed_critical etc. + Example: [nullmailer_queue] user nullmail env.queuedir /var/spool/nullmailer/queue env.errordir /var/spool/nullmailer/failed +env.queue_warning 10 =head1 INTERPRETATION This plugin will draw a stack of 2: the number of emails in the queue, and the number of emails that have permanently failed sending. The latter has -a warning attached, since those should never happen. +a warning attached by default, since those should never happen. =head1 MAGIC MARKERS @@ -50,9 +54,13 @@ GPLv2 =cut +. $MUNIN_LIBDIR/plugins/plugin.sh + queuedir=${queuedir:-/var/spool/nullmailer/queue} errordir=${errordir:-/var/spool/nullmailer/failed} +failed_warning=${failed_warning:-0:0} + case $1 in autoconf) if command -v nullmailer-queue >/dev/null 2>/dev/null; then @@ -76,9 +84,12 @@ queue.info Number of emails currently in the queue failed.label failed failed.draw AREASTACK -failed.warning 0:0 failed.info Number of emails that have permanently failed to send EOF + print_warning queue + print_critical queue + print_warning failed + print_critical failed ;; *) From 69ff4ef307f714fad3289861a6d2fbe784db5504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Arne=20Bj=C3=B8rndal?= Date: Thu, 29 Nov 2018 08:45:02 +0100 Subject: [PATCH 2/2] Fix potential whitespace issue raised in review --- plugins/mail/nullmailer_queue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mail/nullmailer_queue b/plugins/mail/nullmailer_queue index a5028f3f..04aceb3c 100755 --- a/plugins/mail/nullmailer_queue +++ b/plugins/mail/nullmailer_queue @@ -54,7 +54,7 @@ GPLv2 =cut -. $MUNIN_LIBDIR/plugins/plugin.sh +. "$MUNIN_LIBDIR/plugins/plugin.sh" queuedir=${queuedir:-/var/spool/nullmailer/queue} errordir=${errordir:-/var/spool/nullmailer/failed}