mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge pull request #929 from sumpfralle/plugin-postfix-rbl-blocked-mails
Plugin postfix-rbl-blocked-mails: various improvements
This commit is contained in:
commit
5b2396a972
@ -1,24 +1,32 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
#
|
||||
# Made by Stefan Bühler, Switzerland
|
||||
# Monitor blocked Mails during Postfix RBL Scan, included Spamhaus, Spamcop, Manitu, MSRBL, NJABL
|
||||
|
||||
|
||||
LOGFILE=${logfile:-/var/log/mail.log} # Allow user to specify logfile through env.logfile
|
||||
DATE=`date '+%b %e %H'`
|
||||
MAXLABEL=20
|
||||
# Allow user to specify logfile through env.logfile
|
||||
LOGFILE=${logfile:-/var/log/mail.log}
|
||||
DATE=$(date '+%b %e %H')
|
||||
|
||||
|
||||
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
|
||||
if [ -r "$LOGFILE" ]; then
|
||||
echo yes
|
||||
else
|
||||
echo no
|
||||
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'
|
||||
@ -32,14 +40,13 @@ if [ "$1" = "config" ]; then
|
||||
fi
|
||||
|
||||
|
||||
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)
|
||||
echo -en "manitu.value "
|
||||
echo $(grep "blocked using ix.dnsbl.manitu.net" $LOGFILE | grep "$DATE" | wc -l)
|
||||
echo -en "msrbl.value "
|
||||
echo $(grep "blocked using combined.rbl.msrbl.net" $LOGFILE | grep "$DATE" | wc -l)
|
||||
echo -en "njabl.value "
|
||||
echo $(grep "blocked using combined.njabl.org" $LOGFILE | grep "$DATE" | wc -l)
|
||||
|
||||
# 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")"
|
||||
|
Loading…
Reference in New Issue
Block a user