2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/postfix/postfix-rbl-blocked-mails
Lars Kruse 9e47c112b9 Plugin postfix-rbl-blocked-mails: count by top-level-domain
It looks like the spamhaus domain changed from sbl-xbl.spamhaus.org to
zen.spamhaus.org. The same may have happened for other RBL domains.
Thus we just filter by the top level domain (instead of the specific
sub-domain).
2018-08-03 13:05:42 +02:00

54 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#
# Made by Stefan Bühler, Switzerland
# Monitor blocked Mails during Postfix RBL Scan, included Spamhaus, Spamcop, Manitu, MSRBL, NJABL
# Allow user to specify logfile through env.logfile
LOGFILE=${logfile:-/var/log/mail.log}
DATE=`date '+%b %e %H'`
MAXLABEL=20
get_blocked_by_domain_count() {
local escaped_domain
# escape dots - for a proper regular expression
escaped_domain=$(echo "$1" | sed 's/\./\\./g')
grep -c "$DATE.*blocked using [^ ]*${escaped_domain}" "$LOGFILE"
}
if [ "$1" = "autoconf" ]; then
if [ -r "$LOGFILE" ]; then
echo yes
else
echo "no (log file not found: $LOGFILE)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title RBL Counter'
echo 'graph_category mail'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel block during RBL'
echo 'spamhaus.label Blocked by Spamhaus.org'
echo 'spamcop.label Blocked by Spamcop'
echo 'manitu.label Blocked by manitu.net'
echo 'msrbl.label Blocked by msrbl.net'
echo 'njabl.label Blocked by njabl.org'
exit 0
fi
# sbl-xbl.spamhaus.org or zen.spamhaus.org
printf 'spamhaus.value %s\n' "$(get_blocked_by_domain_count "spamhaus.org")"
# bl.spamcop.net
printf 'spamcop.value %s\n' "$(get_blocked_by_domain_count "spamcop.net")"
# ix.dnsbl.manitu.net
printf 'manitu.value %s\n' "$(get_blocked_by_domain_count "manitu.net")"
# combined.rbl.msrbl.net
printf 'msrbl.value %s\n' "$(get_blocked_by_domain_count "msrbl.net")"
# combined.njabl.org
printf 'njabl.value %s\n' "$(get_blocked_by_domain_count "njabl.org")"