diff --git a/plugins/other/postfix_mail_stats b/plugins/other/postfix_mail_stats index e05ff58b..9f191c1d 100755 --- a/plugins/other/postfix_mail_stats +++ b/plugins/other/postfix_mail_stats @@ -1,10 +1,12 @@ -#!/usr/local/bin/bash +#!/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 # +# Modified by Paul Saunders , 10 Dec 2010 +# # Parameters understood: # # config (required) @@ -18,12 +20,16 @@ #%# capabilities=autoconf -LOGFILE=/var/log/maillog +LOGFILE=${logfile:-/var/log/maillog} # Allow user to specify logfile through env.logfile DATE=`date '+%b %e %H'` MAXLABEL=20 if [ "$1" = "autoconf" ]; then - echo yes + if [[ -r $LOGFILE ]]; then + echo yes + else + echo no + fi exit 0 fi @@ -43,12 +49,12 @@ if [ "$1" = "config" ]; then fi echo -en "recieved.value " -echo $(grep "status=sent (delivered to maildir)" $LOGFILE | grep "$DATE" | wc -l) +echo $(grep "status=sent (delivered" $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 $(grep "Helo command 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)