From 2c2b774a3cb7f36576358b84bf252adfea178813 Mon Sep 17 00:00:00 2001 From: cn Date: Tue, 10 Sep 2013 20:48:28 +0200 Subject: [PATCH] Generlize the script allowing custom minute interval, incoming and outgoing regex --- postfix_mailqueue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/postfix_mailqueue b/postfix_mailqueue index 0d847ba..0db064d 100755 --- a/postfix_mailqueue +++ b/postfix_mailqueue @@ -80,6 +80,9 @@ munin-node. =cut MAILLOG=${maillog:-/var/log/mail.log} +MINUTES=${minutes:-5} +OUTGOING_REGEX=${outgoing_regex:-postfix/smtp\[.*status=sent} +INCOMING_REGEX=${incoming_regex:-postfix/pipe\[.*status=sent} # atempt to get spooldir via postconf, but environment overrides. @@ -89,9 +92,9 @@ SPOOLDIR=${spooldir:-$POSTCONFSPOOL} . $MUNIN_LIBDIR/plugins/plugin.sh -syslog5mins() { - #for (( i = 4; i >= 0; i-- )) ; do - for i in 4 3 2 1 0; do +syslogXmins() { + for (( i = $MINUTES; i > 0; i-- )) ; do + #for i in 4 3 2 1 0; do # In %_d the underscore is important since it demands `date` # to pad with spaces (like syslog for e.g. "Jan 1" to "Jan 9") # instead of zeros. @@ -144,10 +147,10 @@ cd $SPOOLDIR >/dev/null 2>/dev/null || { } cat <