2010-12-10 16:23:39 +01:00
|
|
|
#!/bin/bash
|
2009-06-03 00:33:17 +02:00
|
|
|
#
|
|
|
|
# Made by Boudewijn Ector, for Boudewijn Ector IT.
|
|
|
|
# Comments can be sent to (boudewijn<AT>boudewijnector'dot'NL)
|
|
|
|
# Loosely based on http://munin.projects.linpro.no/attachment/wiki/PluginCat/postfix_messages_hourly.txt
|
|
|
|
# Script to show postfix stuff
|
|
|
|
#
|
2010-12-10 16:23:39 +01:00
|
|
|
# Modified by Paul Saunders <darac+munin@darac.org.uk>, 10 Dec 2010
|
|
|
|
#
|
2009-06-03 00:33:17 +02:00
|
|
|
# Parameters understood:
|
|
|
|
#
|
|
|
|
# config (required)
|
|
|
|
# autoconf (optional - used by munin-config)
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Magic markers (optional - used by munin-config and installation
|
|
|
|
# scripts):
|
|
|
|
#
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
|
2010-12-10 16:23:39 +01:00
|
|
|
LOGFILE=${logfile:-/var/log/maillog} # Allow user to specify logfile through env.logfile
|
2009-06-03 00:33:17 +02:00
|
|
|
DATE=`date '+%b %e %H'`
|
|
|
|
MAXLABEL=20
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
2010-12-10 16:23:39 +01:00
|
|
|
if [[ -r $LOGFILE ]]; then
|
|
|
|
echo yes
|
|
|
|
else
|
|
|
|
echo no
|
|
|
|
fi
|
2009-06-03 00:33:17 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
|
|
|
echo 'graph_title Postfix Mail Counter'
|
2017-02-22 19:09:05 +01:00
|
|
|
echo 'graph_category mail'
|
2009-06-03 00:33:17 +02:00
|
|
|
echo 'graph_args --base 1000 -l 0'
|
|
|
|
echo 'graph_vlabel Hourly Messages'
|
2017-02-22 18:43:01 +01:00
|
|
|
echo 'recieved.label Delivered'
|
2009-06-03 00:33:17 +02:00
|
|
|
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
|
|
|
|
|
2017-02-22 18:43:01 +01:00
|
|
|
echo -en "recieved.value "
|
|
|
|
echo $(grep "postfix/lmtp\[" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
echo -n
|
|
|
|
echo -en "sent.value "
|
2017-02-22 18:43:01 +01:00
|
|
|
echo $(grep "postfix/smtp\[" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
echo -en "rejecthelo.value "
|
2017-02-22 18:43:01 +01:00
|
|
|
echo $(grep "Helo command rejected: need fully-qualified hostname" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
echo -en "rejectsenderdomain.value "
|
2017-02-22 18:43:01 +01:00
|
|
|
echo $(grep "Sender address rejected: Domain not found" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo -en "denyrelay.value "
|
2017-02-22 18:43:01 +01:00
|
|
|
echo $(grep "Relay access denied" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
echo -en "spamhaus.value "
|
2017-02-22 18:43:01 +01:00
|
|
|
echo $(grep "blocked using sbl-xbl.spamhaus.org" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
echo -en "spamcop.value "
|
2017-02-22 18:43:01 +01:00
|
|
|
echo $(grep "blocked using bl.spamcop.net" $LOGFILE | grep "$DATE" -c)
|
2009-06-03 00:33:17 +02:00
|
|
|
|