From 6be31faed3d43526eabb14daceb39d6a6eadb551 Mon Sep 17 00:00:00 2001 From: Boudewijn Ector Date: Wed, 3 Jun 2009 00:33:17 +0200 Subject: [PATCH] Initial version --- plugins/other/postfix_mail_stats | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 plugins/other/postfix_mail_stats diff --git a/plugins/other/postfix_mail_stats b/plugins/other/postfix_mail_stats new file mode 100755 index 00000000..e05ff58b --- /dev/null +++ b/plugins/other/postfix_mail_stats @@ -0,0 +1,62 @@ +#!/usr/local/bin/bash +# +# Made by Boudewijn Ector, for Boudewijn Ector IT. +# Comments can be sent to (boudewijnboudewijnector'dot'NL) +# Loosely based on http://munin.projects.linpro.no/attachment/wiki/PluginCat/postfix_messages_hourly.txt +# Script to show postfix stuff +# +# Parameters understood: +# +# config (required) +# autoconf (optional - used by munin-config) +# +# +# Magic markers (optional - used by munin-config and installation +# scripts): +# +#%# family=auto +#%# capabilities=autoconf + + +LOGFILE=/var/log/maillog +DATE=`date '+%b %e %H'` +MAXLABEL=20 + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title Postfix Mail Counter' + echo 'graph_args --base 1000 -l 0' + echo 'graph_vlabel Hourly Messages' + echo 'recieved.label Delivered' + echo 'sent.label Outgoing' + echo 'rejecthelo.label Invalid HELO' + echo 'rejectsenderdomain.label need FQDN' + echo 'denyrelay.label Relay Denied' + echo 'spamhaus.label Blocked using Spamhaus.org' + echo 'spamcop.label Blocked using Spamcop' + exit 0 +fi + +echo -en "recieved.value " +echo $(grep "status=sent (delivered to maildir)" $LOGFILE | grep "$DATE" | wc -l) +echo -n +echo -en "sent.value " +echo $(grep "status=sent (250" $LOGFILE | grep "$DATE" | wc -l) +echo -en "rejecthelo.value " +echo $(grep "Helocommand rejected: need fully-qualified hostname" $LOGFILE | grep "$DATE" | wc -l) +echo -en "rejectsenderdomain.value " +echo $(grep "Sender address rejected: Domain not found" $LOGFILE | grep "$DATE" | wc -l) + + +echo -en "denyrelay.value " +echo $(grep "Relay access denied" $LOGFILE | grep "$DATE" | wc -l) +echo -en "spamhaus.value " +echo $(grep "blocked using sbl-xbl.spamhaus.org" $LOGFILE | grep "$DATE" | wc -l) +echo -en "spamcop.value " +echo $(grep "blocked using bl.spamcop.net" $LOGFILE | grep "$DATE" | wc -l) +