1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

- have some dirs

This commit is contained in:
Steve Schnepp 2012-02-13 18:24:46 +01:00
parent 0b089ea777
commit 08346aac58
687 changed files with 0 additions and 0 deletions

192
plugins/mail/amavis_ Executable file
View file

@ -0,0 +1,192 @@
#!/usr/bin/perl -w
#
# Plugin to monitor amavisd-new statistics. Values are retrieved by querying
# the BerkeleyDB database 'snmp.db', in which amavisd-new stores its
# statistics.
#
# The plugin requires the Perl module BerkeleyDB.
#
# To use, setup /etc/munin/plugin-conf.d/amavis e.g. as follows:
#
# [amavis_*]
# env.amavis_db_home /var/lib/amavis/db
# user amavis
#
# Where env.amavis_db_home is the path to the amavisd-new BerkeleyDB files
# (/var/amavis/db by default).
#
# Then create symlinks in the Munin plugin directory named "amavis_time",
# "amavis_cache" and "amavis_content", or use munin-node-configure.
#
# Parameters:
#
# config
# autoconf
# suggest
#
# Config variables:
#
# amavis_db_home - where the amavisd-new berkeley db files are located
#
# Magic markers
#%# family=auto
#%# capabilities=autoconf
#%# capabilities=suggest
use strict;
no warnings 'uninitialized';
use BerkeleyDB;
my($dbfile) = 'snmp.db';
my($db_home) = # DB databases directory
defined $ENV{'amavis_db_home'} ? $ENV{'amavis_db_home'} : '/var/amavis/db';
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
if (-x "/usr/sbin/amavisd-agent") {
print "yes\n";
exit 0;
} else {
print "no (/usr/sbin/amavisd-agent not found or not executable)\n";
exit 1;
}
} elsif ($ARGV[0] and $ARGV[0] eq "suggest") {
print "time\n";
print "cache\n";
print "content\n";
exit 0;
}
my $stats_type = "";
if ($0 =~ /^(?:|.*\/)amavis_(cache|content|time)$/) {
$stats_type = $1;
} else {
print "You need to create a symlink to this plugin called either amavis_cache, amavis_time or amavis_content to be able to use it.\n";
exit 2;
}
if ($ARGV[0] and $ARGV[0] eq "config") {
if ($stats_type eq "cache") {
print "graph_title Amavis cache hit / miss ratio\n";
print "graph_args --lower-limit 0 --upper-limit 100 --rigid\n";
print "graph_category mail\n";
print "graph_info The ratio of cache hits and misses for AMaViSd-new.\n";
print "graph_order hits misses\n";
print "graph_scale no\n";
print "graph_vlabel %\n";
print "hits.label Cache hits\n";
print "hits.draw AREA\n";
print "hits.max 100\n";
print "hits.min 0\n";
print "misses.label Cache misses\n";
print "misses.draw STACK\n";
print "misses.max 100\n";
print "misses.min 0\n";
} elsif ($stats_type eq "content") {
print "graph_title Amavis scanned mails\n";
print "graph_category mail\n";
print "graph_period minute\n";
print "graph_vlabel msgs / \${graph_period}\n";
foreach my $type (qw(total clean spam spammy virus)) {
print "$type.label " . ucfirst($type) . " mails \n";
print "$type.type DERIVE\n";
print "$type.min 0\n";
}
print "clean.info Legitimate mail.\n";
print "spammy.info Mails with a spam score above the tag2 level.\n";
print "spam.info Mails with a spam score above the kill level for spam.\n";
print "virus.info Mails with a virus.\n";
print "total.info Total number of scanned mails.\n";
} elsif ($stats_type eq "time") {
print "graph_title Amavis average scan time\n";
print "graph_info Average time spent in each phase of the mail scanning process, per mail.\n";
print "graph_category mail\n";
print "graph_vlabel sec / mail\n";
print "graph_scale no\n";
print "msgs.label Total number of messages\n";
print "msgs.graph no\n";
print "msgs.type DERIVE\n";
print "msgs.min 0\n";
foreach my $type (qw(decoding receiving sending spamcheck viruscheck total)) {
print "${type}.label " . ucfirst($type) . "\n";
print "${type}.type DERIVE\n";
print "${type}.min 0\n";
print "${type}.cdef ${type},1000,/,msgs,/\n";
}
}
exit 0;
}
my ($env, $db, @dbstat, $cursor);
@dbstat = stat("$db_home/$dbfile");
my $errn = @dbstat ? 0 : 0+$!;
$errn == 0 or die "stat $db_home/$dbfile: $!";
$env = BerkeleyDB::Env->new(
-Home => $db_home,
-Flags => DB_INIT_CDB | DB_INIT_MPOOL,
-ErrFile => \*STDOUT,
-Verbose => 1,
);
defined $env or die "BDB no env: $BerkeleyDB::Error $!";
$db = BerkeleyDB::Hash->new(-Filename => $dbfile, -Env => $env);
defined $db or die "BDB no db: $BerkeleyDB::Error $!";
my %values = ();
my ($eval_stat, $stat, $key, $val);
$cursor = $db->db_cursor; # obtain read lock
defined $cursor or die "db_cursor error: $BerkeleyDB::Error";
while (($stat = $cursor->c_get($key, $val, DB_NEXT)) == 0) {
$values{$key} = $val;
}
$stat == DB_NOTFOUND or die "c_get: $BerkeleyDB::Error $!";
$cursor->c_close == 0 or die "c_close error: $BerkeleyDB::Error";
$cursor = undef;
$eval_stat = $@;
if ($eval_stat ne '') { chomp($eval_stat); die "BDB $eval_stat\n"; }
for my $k (sort keys %values) {
if ($values{$k} =~ /^(?:C32|C64) (.*)\z/) {
$values{$k} = $1;
}
}
if ($stats_type eq "cache") {
my $hits = $values{'CacheHits'};
my $misses = $values{'CacheMisses'};
my $misses_ratio = $misses * 100.00 / ($hits + $misses);
my $hits_ratio = $hits * 100.00 / ($hits + $misses);
printf("hits.value %.1f\n", $hits_ratio);
printf("misses.value %.1f\n", $misses_ratio);
} elsif ($stats_type eq "content") {
printf("total.value %d\n", $values{'InMsgs'});
my $clean = $values{'ContentCleanMsgs'};
if (defined($values{'ContentCleanTagMsgs'})) {
$clean += $values{'ContentCleanTagMsgs'};
}
printf("clean.value %d\n", $clean);
printf("spam.value %d\n", $values{'ContentSpamMsgs'});
printf("spammy.value %d\n", $values{'ContentSpammyMsgs'});
printf("virus.value %d\n", $values{'ContentVirusMsgs'});
} elsif ($stats_type eq "time") {
printf("decoding.value %d\n", $values{'TimeElapsedDecoding'});
printf("receiving.value %d\n", $values{'TimeElapsedReceiving'});
printf("sending.value %d\n", $values{'TimeElapsedSending'});
printf("spamcheck.value %d\n", $values{'TimeElapsedSpamCheck'});
printf("viruscheck.value %d\n", $values{'TimeElapsedVirusCheck'});
printf("total.value %d\n", $values{'TimeElapsedTotal'});
printf("msgs.value %d\n", $values{'InMsgs'});
}
$db->db_close == 0 or die "BDB db_close error: $BerkeleyDB::Error $!";

84
plugins/mail/amavis_awk Executable file
View file

@ -0,0 +1,84 @@
#!/bin/bash
#
# Plugin to monitor Amavis virus and spam statistics.
#
#
# Based on a routine by William Towle
# Uncomment the cdef lines to convert the graph to mails/minute
# Comment out the line "total.graph no" to show the total on the graph. This may not be aesthetically pleasing.
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# requires logtail
LOGDIR=${logdir:-/var/log/amavis}
MAIL_LOG=$LOGDIR/${logfile:-amavisd.log}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/amavis.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Amavis message filtering'
echo 'graph_category mail'
echo 'graph_vlabel Mails per minute'
echo 'graph_args --base 1000 -l 0'
echo 'graph_order clean p_spam b_spam virus total'
echo 'clean.min 0'
echo 'clean.type ABSOLUTE'
#echo 'clean.cdef clean,60,*'
echo 'clean.draw AREA'
for i in p_spam b_spam virus;
do
echo "$i.min 0"
echo "$i.type ABSOLUTE";
#echo "$i.cdef $i,60,*";
echo "$i.draw STACK";
done
echo 'clean.label Passed CLEAN'
echo 'p_spam.label Passed SPAMMY'
echo 'b_spam.label Blocked SPAMMY'
echo 'virus.label Blocked INFECTED'
echo 'total.label Total'
echo 'total.graph no'
echo 'clean.colour 00ff00'
echo 'p_spam.colour ff4000'
echo 'b_spam.colour ff0000'
echo 'virus.colour 000000'
exit 0
fi
$LOGTAIL ${MAIL_LOG} $STATEFILE | \
awk 'BEGIN { na= 0; nb= 0; nc= 0; nd= 0; total= 0 }
{
if (index($0, "Passed CLEAN")) { na++ ; total++ }
else if (index($0, "Passed SPAMMY")) { nb++ ; total++ }
else if (index($0, "Blocked SPAMMY")) { nc++ ; total++ }
else if (index($0, "INFECTED")) { nd++ ; total++ }
}
END { print "clean.value " na"\np_spam.value " nb"\nb_spam.value " nc"\nvirus.value " nd"\ntotal.value " total }'

31
plugins/mail/clamav Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
#%# family=manual
#%# capabilities=autoconf
log=/var/log/clamav/clamd.log
if [ "$1" = "autoconf" ]; then
if [ -r $log ]; then
echo "yes"
else
echo "no (cannot read $log)"
fi
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOT
graph_title ClamAV stats
graph_args --base 1000 -l 0
graph_vlabel virus/day
graph_category Mail
virus.label virus
virus.type DERIVE
virus.min 0
virus.draw AREA
virus.cdef virus,86400,*
EOT
exit 0
fi
echo -n "virus.value " && fgrep -c FOUND $log

66
plugins/mail/courier_log Executable file
View file

@ -0,0 +1,66 @@
#!/bin/sh
#
# Plugin to count specific log categories for courier servers (pop3/imap)
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=suggest
CATEGORIES="peer_reset Reset_by_peer Connection reset by peer
conn_timeout Connection_timeout Connection timed out
disconnected Disconnected DISCONNECTED
timeout Timeout TIMEOUT
login Login LOGIN
logout Logout LOGOUT
mem_full FAM_needs_restart malloc: Input/output error
conn_full Connection_limit_reached malloc: Input/output error"
LOG_FILE=${LOG_FILE:-/var/log/mail.info}
SUGGESTIONS="pop3d pop3d-ssl imapd imapd-ssl"
# "autoconf" and "suggest" only work reliably if the mail server already
# contains some log entries.
if [ "$1" = "autoconf" ]; then
[ ! -e "$LOG_FILE" ] && echo "no (no log file found: $LOG_FILE)" && exit 0
for suggestion in $SUGGESTIONS; do
grep -q " $suggestion: " "$LOG_FILE" && echo "yes" && exit 0
done
# no suitable line found in the log file
echo "no (no courier pop3d/imapd lines in $LOG_FILE found)"
exit 0
fi
if [ "$1" = "suggest" ]; then
for suggestion in $SUGGESTIONS; do
grep -q " $suggestion: " "$LOG_FILE" && echo "$suggestion"
done
exit 0
fi
type=$(basename "$0" | tr "_" "\n" | tail -1)
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Courier log ($type)
graph_args --base 1000 -l 0
graph_vlabel events per second
graph_category Mail
EOT
echo "$CATEGORIES" | while read field label match; do
echo "${field}.label $(echo "$label" | tr "_" " ")"
echo "${field}.type DERIVE"
echo "${field}.min 0"
done
exit 0
fi
echo "$CATEGORIES" | while read field label match; do
echo -n "${field}.value "
grep " $type: " "$LOG_FILE" | grep "$match" | wc -l
done

88
plugins/mail/dkimproxy_mails Executable file
View file

@ -0,0 +1,88 @@
#!/bin/bash
#
# Plugin to monitor incoming DKIM mail.
#
# Florian Sager, sager@agitos.de, 2008-02-06
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# Gives the result of the verification. The following values are possible:
#
# pass
# Returned if a valid DKIM-Signature header was found, and the signature contains a correct value for the message.
#
# fail
# Returned if a valid DKIM-Signature header was found, but the signature does not contain a correct value for the message.
#
# invalid
# Returned if no valid DKIM-Signature headers were found, but there is at least one invalid DKIM-Signature header. For a reason why a DKIM-Signature header found in the message was invalid, see $dkim->{signature_reject_reason}.
#
# none
# Returned if no DKIM-Signature headers (valid or invalid) were found.
#
# In case of multiple signatures, the "best" result will be returned. Best is defined as "pass", followed by "fail", "invalid", and "none".
#
mktempfile () {
mktemp -t
}
MAIL_LOG=${logfile:-/var/log/mail.log}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/dkimproxy_mails.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title DKIM Proxy mails'
echo 'graph_order dkimnone dkimpass dkiminvalid dkimfail'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_args --base 1000 -l 0'
# echo 'graph_total total'
echo 'dkimnone.label No DKIM-Sigs'
echo 'dkimnone.min 0'
echo 'dkimpass.label Valid DKIM-Sigs'
echo 'dkimpass.min 0'
echo 'dkiminvalid.label Invalid DKIM-Sigs'
echo 'dkiminvalid.min 0'
echo 'dkimfail.label Failed DKIM-Sigs'
echo 'dkimfail.min 0'
exit 0
fi
dkimnone=U
dkimpass=U
dkiminvalid=U
dkiminfail=U
TEMP_FILE=`mktempfile munin-dkimproxy_mails.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep "DKIM verify - " > ${TEMP_FILE}
dkimnone=`grep 'DKIM verify - none' ${TEMP_FILE} | wc -l`
dkimpass=`grep 'DKIM verify - pass' ${TEMP_FILE} | wc -l`
dkiminvalid=`grep 'DKIM verify - invalid' ${TEMP_FILE} | wc -l`
dkimfail=`grep 'DKIM verify - fail' ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "dkimnone.value ${dkimnone}"
echo "dkimpass.value ${dkimpass}"
echo "dkiminvalid.value ${dkiminvalid}"
echo "dkimfail.value ${dkimfail}"

48
plugins/mail/mail_connections Executable file
View file

@ -0,0 +1,48 @@
#!/bin/sh
#
# Plugin to count the open connections for smtp, pop3 and imap
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=auto
#%# capabilities=autoconf
PORTS="25 smtp SMTP
110 pop3 POP3
143 imap IMAP
465 ssmtp SMTP-SSL
587 submission SMTP (submission)
993 imaps IMAP-SSL
995 pop3s POP3-SSL"
if [ "$1" = "autoconf" ]; then
ports=$(echo "$PORTS" | cut -f 1 -d " ")
for port in $ports; do
netstat -ln | grep -q ":$port " && echo "yes" && exit 0
done
# no open connections for typical mail ports found
echo "no (no listeners for smtp/pop3/imap ports found)"
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Open mail server connections
graph_args --base 1000 -l 0
graph_vlabel connections per second
graph_category Mail
EOT
echo "$PORTS" | while read port field label; do
echo "${field}.label $label"
echo "${field}.type DERIVE"
echo "${field}.min 0"
done
exit 0
fi
echo "$PORTS" | while read port field label; do
echo -n "${field}.value "
netstat -n | grep ":$port " | wc -l
done

128
plugins/mail/mixminion Executable file
View file

@ -0,0 +1,128 @@
#!/bin/sh
#
# plugin to monitor mixminion stats
# pesco 2011, isc license
# munin metadata:
#%# capabilities=autoconf suggest
PATH=/bin:/usr/bin:/usr/local/bin
case $0 in
*_relay)
FIELDNAMES="AttemptedRelay SuccessfulRelay FailedRelay UnretriableRelay ReceivedPacket";;
*_exit)
FIELDNAMES="AttemptedDelivery SuccessfulDelivery FailedDelivery UnretriableDelivery";;
*)
FIELDNAMES="ReceivedConnection AttemptedConnect SuccessfulConnect FailedConnect";;
esac
case $1 in
autoconf)
# see if we got mixminion installed
if which mixminiond >/dev/null; then
echo "yes"
else
echo "no"
fi
exit 0;;
suggest)
desc="`cat /var/lib/mixminion/current-desc`"
echo connections
grep -q '^\[Incoming/MMTP\]' "$desc" && echo relay
grep -q '^\[Delivery/SMTP\]' "$desc" && echo exit
exit 0;;
config)
echo "graph_category mail"
echo "graph_args --base 1000 -l 0"
case $0 in
*_relay)
cat <<'EOM'
graph_title Mixminion relay
graph_vlabel packets per second
AttemptedRelay.label packets to relay
AttemptedRelay.info Total number of packets that we attempted to relay
AttemptedRelay.draw LINE2
FailedRelay.label relay errors
FailedRelay.info Number of packets that we (momentarily) failed to relay
FailedRelay.draw AREASTACK
UnretriableRelay.label permanent failures
UnretriableRelay.info Number of packets that we permanently gave up trying to relay
UnretriableRelay.draw AREASTACK
SuccessfulRelay.label relay success
SuccessfulRelay.info Number of packets that we successfully relayed
SuccessfulRelay.draw AREASTACK
SuccessfulRelay.graph no
ReceivedPacket.label incoming packets
ReceivedPacket.info Total number of packets that we received
ReceivedPacket.draw LINE2
EOM
;;
*_exit)
cat <<'EOM'
graph_title Mixminion exit
graph_vlabel messages per second
AttemptedDelivery.label messages to deliver
AttemptedDelivery.info Total number of emails that we tried to deliver
AttemptedDelivery.draw LINE2
FailedDelivery.label delivery errors
FailedDelivery.info Number of emails that we (momentarily) failed to deliver
FailedDelivery.draw AREASTACK
UnretriableDelivery.label permanent failures
UnretriableDelivery.info Number of emails that we permanently gave up trying to deliver
UnretriableDelivery.draw AREASTACK
SuccessfulDelivery.label delivery successes
SuccessfulDelivery.info Number of emails successfully delivered
SuccessfulDelivery.draw AREASTACK
SuccessfulDelivery.graph no
EOM
;;
*)
cat <<'EOM'
graph_title Mixminion connections
graph_vlabel connections in (-) / out (+) per second
ReceivedConnection.label incoming
ReceivedConnection.info number of successful incoming connections
ReceivedConnection.graph no
AttemptedConnect.label total conn's
AttemptedConnect.info Total number of attempted outgoing connections
AttemptedConnect.draw LINE2
AttemptedConnect.negative ReceivedConnection
FailedConnect.label conn. failures
FailedConnect.info Number of failed outgoing connections
FailedConnect.draw AREASTACK
SuccessfulConnect.label successful
SuccessfulConnect.info Number of successful in-/outgoin connections
SuccessfulConnect.draw AREASTACK
SuccessfulConnect.graph no
EOM
;;
esac
for field in $FIELDNAMES; do
echo "$field.type DERIVE"
echo "$field.min 0"
done
exit 0;;
esac
mixminion server-stats 2>/dev/null | perl -e '
while(<STDIN>) {
if(/^ *([[:alnum:]]+): *([.[:digit:]]+)/ &&
grep {$_ eq $1} @ARGV) {
print "$1.value $2\n";
}
}
' $FIELDNAMES

53
plugins/mail/postfix-policyd Executable file
View file

@ -0,0 +1,53 @@
#!/bin/bash
#
# Plugin to monitor incoming mails greylisted by postfix-policyd
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
MYSQL_USER="postfix-policyd"
MYSQL_PASS=""
MYSQL_DB="postfixpolicyd"
if [ "$1" = "autoconf" ]; then
if [ -n "${MYSQL_PASS}" ] ; then
echo yes
exit 0
else
echo "no (set mysql pass)"
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Postfix-Policyd daily filtering'
echo 'graph_order delayed passed whitelisted'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_scale no'
## echo 'graph_args --base 1000 -l 0'
echo 'delayed.label delayed'
echo 'delayed.type GAUGE'
echo 'passed.label passed'
echo 'passed.type GAUGE'
echo 'whitelisted.label whitelisted'
echo 'whitelisted.type GAUGE'
echo 'blacklisted.label blacklisted'
echo 'blacklisted.type GAUGE'
exit 0
fi
DELAYED="`echo "SELECT COUNT(*) FROM triplet WHERE _count = 0" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
PASSED="`echo "SELECT COUNT(*) FROM triplet WHERE _count != 0" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
WHITELISTED="`echo "SELECT COUNT(*) FROM whitelist" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
BLACKLISTED="`echo "SELECT COUNT(*) FROM blacklist" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
echo "delayed.value ${DELAYED}"
echo "passed.value ${PASSED}"
echo "whitelisted.value ${WHITELISTED}"
echo "blacklisted.value ${BLACKLISTED}"

View file

@ -0,0 +1,45 @@
#!/bin/bash
#
# 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
if [ "$1" = "autoconf" ]; then
if [[ -r $LOGFILE ]]; then
echo yes
else
echo no
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
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)

160
plugins/mail/postfix_filtered Executable file
View file

@ -0,0 +1,160 @@
#!/bin/bash
#
# Plugin to monitor incoming Postfix mail.
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# If you are using a postfix policy daemon (such as policyd) to track certain block conditions, place a line
# in your /etc/munin/plugin-conf.d/munin-node like:
#
# [postfix*]
# env.policy my policy string
#
# When env.policy is set, this plugin will match the string you supply as env.policy and return the number of instances
# of that string as an output called "policy.value".
#
# If you are NOt using a postfix policy daemon, as above, use the line
#
# [postfix*]
# env.policy none
#
# and this plugin will suppress output of policy.value
POLICY=${policy}
if [ "$POLICY" = "none" ]
then POLICY=""
fi
LOGDIR=${logdir:-/var/log/mail}
MAIL_LOG=$LOGDIR/${logfile:-info}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/postfix_mailfiltered.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Postfix message filtering'
if [ -z "$POLICY" ]
then
echo 'graph_order allowed rbl helo client sender recipient relay'
else
echo 'graph_order allowed rbl policy helo client sender recipient relay'
fi
echo 'graph_category mail'
echo 'graph_vlabel Mails per second'
echo 'graph_args --base 1000 -l 0'
echo 'allowed.label Allowed'
echo 'allowed.min 0'
echo 'allowed.type ABSOLUTE'
echo 'rbl.label RBL blocked'
echo 'rbl.min 0'
echo 'rbl.type ABSOLUTE'
if [ -z "$POLICY" ]
then
echo "empty" > /dev/null
else
echo 'policy.label Policy blocked'
echo 'policy.min 0'
echo 'policy.type ABSOLUTE'
fi
echo 'helo.label HELO rejected'
echo 'helo.min 0'
echo 'helo.type ABSOLUTE'
echo 'client.label Client rejected'
echo 'client.min 0'
echo 'client.type ABSOLUTE'
echo 'sender.label Sender rejected'
echo 'sender.min 0'
echo 'sender.type ABSOLUTE'
echo 'recipient.label Recipient unknown'
echo 'recipient.min 0'
echo 'recipient.type ABSOLUTE'
echo 'relay.label Relay denied'
echo 'relay.min 0'
echo 'relay.type ABSOLUTE'
exit 0
fi
if [ -z "$POLICY" ]
then
result=`$LOGTAIL ${MAIL_LOG} $STATEFILE \
| egrep "postfix\/smtpd?\[[0-9]*\]: ([NOQUA-F]+:|[A-F0-9]+:) " \
| grep -v "Server configuration problem" \
| grep -v "Data command rejected" \
| grep -v " client=" \
| sed -e "s/.*\(Relay access denied\|blocked using\|Helo command rejected\|Client host rejected\|Sender address rejected\|Recipient address rejected\|queued as\).*/\1/g" \
| sort | uniq -c \
| sed -e "s/ *\([0-9]\+\) queued as/value.allowed \1/" \
| sed -e "s/ *\([0-9]\+\) Relay access denied/value.relay \1/" \
| sed -e "s/ *\([0-9]\+\) blocked using/value.rbl \1/" \
| sed -e "s/ *\([0-9]\+\) Helo command rejected/value.helo \1/" \
| sed -e "s/ *\([0-9]\+\) Client host rejected/value.client \1/" \
| sed -e "s/ *\([0-9]\+\) Sender address rejected/value.sender \1/" \
| sed -e "s/ *\([0-9]\+\) Recipient address rejected/value.recipient \1/" `
else
result=`$LOGTAIL ${MAIL_LOG} $STATEFILE \
| egrep "postfix\/smtpd?\[[0-9]*\]: ([NOQUA-F]+:|[A-F0-9]+:) " \
| grep -v "Server configuration problem" \
| grep -v " client=" \
| sed -e "s/.*\(Relay access denied\|blocked using\|Helo command rejected\|Client host rejected\|Sender address rejected\|Recipient address rejected\|$POLICY\|queued as\).*/\1/g" \
| sort | uniq -c \
| sed -e "s/ *\([0-9]\+\) queued as/value.allowed \1/" \
| sed -e "s/ *\([0-9]\+\) Relay access denied/value.relay \1/" \
| sed -e "s/ *\([0-9]\+\) blocked using/value.rbl \1/" \
| sed -e "s/ *\([0-9]\+\) Helo command rejected/value.helo \1/" \
| sed -e "s/ *\([0-9]\+\) Client host rejected/value.client \1/" \
| sed -e "s/ *\([0-9]\+\) Sender address rejected/value.sender \1/" \
| sed -e "s/ *\([0-9]\+\) Recipient address rejected/value.recipient \1/" \
| sed -e "s/ *\([0-9]\+\) $POLICY/value.policy \1/" `
fi
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.allowed/allowed.value/" | grep "allowed" ) || echo "allowed.value 0"
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.rbl/rbl.value/" | grep "rbl" ) || echo "rbl.value 0"
if [ -z "$POLICY" ]
then
echo "empty" > /dev/null
else
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.policy/policy.value/" | grep "policy" ) || echo "policy.value 0"
fi
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.helo/helo.value/" | grep "helo" ) || echo "helo.value 0"
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.client/client.value/" | grep "client" ) || echo "client.value 0"
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.sender/sender.value/" | grep "sender" ) || echo "sender.value 0"
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.recipient/recipient.value/" | grep "recipient" ) || echo "recipient.value 0"
(echo $result | sed -e "s/value/\nvalue/g" | sed -e "s/value.relay/relay.value/" | grep "relay" ) || echo "relay.value 0"

115
plugins/mail/postfix_filtered_awk Executable file
View file

@ -0,0 +1,115 @@
#!/bin/bash
#
# Plugin to monitor incoming Postfix mail.
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# requires logtail
# If you are using a postfix policy daemon (such as policyd) to track certain block conditions, place a line
# in your /etc/munin/plugin-conf.d/munin-node like:
#
# [postfix_filtered]
# env.policy my policy string
#
# When env.policy is set, this plugin will match the string you supply as env.policy and return the number of instances
# of that string as an output called "policy.value".
#
# If you are NOT using a postfix policy daemon, as above, use the line
#
# [postfix_filtered]
# env.policy none
#
# and this plugin will suppress output of policy.value
POLICY=''
[ "${policy}" = 'none' ] || POLICY="${policy}"
export POLICY
LOGDIR=${logdir:-/var/log/mail}
MAIL_LOG=$LOGDIR/${logfile:-info}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/postfix_mailfiltered_test.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Postfix message filtering'
echo 'graph_category mail'
echo 'graph_vlabel Mails per second'
# echo 'graph_args --base 1000 --logarithmic'
echo 'graph_args --base 1000 -l 0'
if [ -z "$POLICY" ]
then
echo 'graph_order rbl helo client sender recipient relay allowed'
else
echo 'graph_order rbl policy helo client sender recipient relay allowed'
echo 'policy.label policy blocked'
echo 'policy.min 0'
echo 'policy.draw LINE1'
echo 'policy.type ABSOLUTE'
fi
echo 'allowed.draw LINE2'
echo 'allowed.type ABSOLUTE'
echo 'allowed.colour 00ff00'
echo 'rbl.draw LINE2'
echo 'rbl.type ABSOLUTE'
echo 'rbl.colour 1010ff'
for i in helo client sender recipient relay;
do
echo "$i.min 0"
echo "$i.type ABSOLUTE"
echo "$i.draw LINE1";
done
echo 'allowed.label allowed'
echo 'rbl.label RBL blocked'
echo 'helo.label HELO rejected'
echo 'client.label Client rejected'
echo 'sender.label Sender rejected'
echo 'recipient.label recipient unknown'
echo 'relay.label relay denied'
exit 0
fi
$LOGTAIL ${MAIL_LOG} $STATEFILE | \
awk 'BEGIN { na= 0; nb= 0; nc= 0; nd= 0; ne= 0; nf= 0; ng= 0; nh= 0 ; st= ENVIRON["POLICY"] }
{
if (index($0, "queued as")) { na++ }
else if (index($0, "Relay access denied")) { nb++ }
else if (index($0, "blocked using")) { nc++ }
else if (index($0, "Helo command rejected")) { nd++ }
else if (index($0, "Client host rejected")) { ne++ }
else if (index($0, "Sender address rejected")) { nf++ }
else if (index($0, "Recipient address rejected")) { ng++ }
else if (st && index($0, st)) { nh++ }
}
END { print "allowed.value " na"\nrelay.value " nb"\nrbl.value " nc"\nhelo.value " nd"\nclient.value " ne"\nsender.value " nf"\nrecipient.value " ng ; if (st) print "policy.value " nh }'

View file

@ -0,0 +1,84 @@
#!/bin/bash
#
# Plugin to monitor incoming Postfix mail.
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
mktempfile () {
mktemp -t
}
MAIL_LOG=${logfile:-/var/log/mail.log}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/postfix_mailfiltered.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Postfix daily filtering'
echo 'graph_order relay rbl helo client sender recipient'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_args --base 1000 -l 0'
echo 'graph_total total'
echo 'relay.label Relay denied'
echo 'relay.min 1'
echo 'rbl.label RBL blocked'
echo 'rbl.min 1'
echo 'helo.label HELO rejected'
echo 'helo.min 1'
echo 'client.label Client rejected'
echo 'client.min 1'
echo 'sender.label Sender rejected'
echo 'sender.min 1'
echo 'recipient.label Recipient unknown'
echo 'recipient.min 1'
exit 0
fi
relay=u
rbl=U
helo=U
client=U
sender=U
recipient=U
TEMP_FILE=`mktempfile munin-postfix_filtered.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep "postfix\/smtpd\[[0-9]*\]: NOQUEUE: reject:" > ${TEMP_FILE}
relay=`grep 'Relay access denied' ${TEMP_FILE} | wc -l`
rbl=`grep 'blocked using' ${TEMP_FILE} | wc -l`
helo=`grep 'Helo command rejected' ${TEMP_FILE} | wc -l`
client=`grep 'Client host rejected' ${TEMP_FILE} | wc -l`
sender=`grep 'Sender address rejected' ${TEMP_FILE} | wc -l`
recipient=`grep 'Recipient address rejected' ${TEMP_FILE} | grep -v "Greylisted" | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "relay.value ${relay}"
echo "rbl.value ${rbl}"
echo "helo.value ${helo}"
echo "client.value ${client}"
echo "sender.value ${sender}"
echo "recipient.value ${recipient}"

50
plugins/mail/postfix_stats Executable file
View file

@ -0,0 +1,50 @@
#!/bin/sh
#
# Plugin to show Postfix statistics - needs pflogsumm
#
# Contributed by David Obando (david@cryptix.de) - 16.04.2007
#
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
#set -xv
case $1 in
config)
cat <<'EOF'
system.type COUNTER
graph_title Postfix statistics
graph_vlabel Postfix statistics
graph_category Mail
graph_total Total
received.label received
delivered.label delivered
forwarded.label forwarded
deferred.label deferred
bounced.label bounced
rejected.label rejected
held.label held
discarded.label discarded
EOF
exit 0;;
esac
TMP=`mktemp /tmp/tmp.XXXXXXXX`
pflogsumm.pl --smtpd_stats -d today /var/log/syslog /var/log/syslog.0 | head -n 15 > $TMP
cat <<EOF
received.value `grep 'received' $TMP | awk '{print $1}'`
delivered.value `grep 'delivered' $TMP | awk '{print $1}'`
forwarded.value `grep 'forwarded' $TMP | awk '{print $1}'`
deferred.value `grep 'deferred' $TMP | awk '{print $1}'`
bounced.value `grep 'bounced' $TMP | awk '{print $1}'`
rejected.value `grep 'rejected' $TMP | awk '{print $1}'`
held.value `grep 'held' $TMP | awk '{print $1}'`
discarded.value `grep 'discarded' $TMP | awk '{print $1}'`
EOF

81
plugins/mail/postgrey Executable file
View file

@ -0,0 +1,81 @@
#!/bin/bash
#
# Plugin to monitor incoming Postgrey
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
mktempfile () {
mktemp -t
}
MAIL_LOG=${logfile:-/var/log/mail.log}
STATEFILE=/var/lib/munin/plugin-state/postgrey.offset
LOGTAIL=${logtail:-`which logtail`}
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Postgrey daily filtering'
echo 'graph_order delayed passed whitelisted'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_scale no'
## echo 'graph_args --base 1000 -l 0'
echo 'delayed.label delayed'
# echo 'delayed.type DERIVE'
echo 'passed.label passed'
# echo 'passed.type DERIVE'
echo 'whitelisted.label whitelisted'
# echo 'whitelisted.type DERIVE'
exit 0
fi
delayed=0
passed=0
whitelisted=0
ARGS=0
`$LOGTAIL /etc/hosts 2>/dev/null >/dev/null`
if [ $? = 66 ]; then
if [ ! -n "$logtail" ]; then
ARGS=1
fi
fi
TEMP_FILE=`mktempfile munin-postgrey.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
if [ $ARGS != 0 ]; then
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep 'post[fix|grey]' > ${TEMP_FILE}
else
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep 'post[fix|grey]' > ${TEMP_FILE}
fi
delayed=`grep 'Recipient address rejected.*Greylisted' ${TEMP_FILE} | wc -l`
passed=`grep 'postgrey\[[0-9]*\]: delayed [0-9]* seconds:' ${TEMP_FILE} | wc -l`
whitelisted=`grep 'postgrey\[[0-9]*\]: whitelisted:' ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "delayed.value ${delayed}"
echo "passed.value ${passed}"
echo "whitelisted.value ${whitelisted}"

160
plugins/mail/postgrey-new Executable file
View file

@ -0,0 +1,160 @@
#! /usr/bin/perl
###################################################################
# Munins Plugin to monitor actions of postgrey greylisting daemon #
# Version 0.1 #
###################################################################
######################### Configuration ###########################
# Usually this plugin will look in /var/log/mail.log for the #
# output of postgrey. You can change that by setting env.logfile #
# The state file is /var/lib/munin/plugin-state/postgrey-new.state#
# This can be changed by setting env.statefile #
# Keep in mind to grant enough rigths in order to open the #
# logfiles etc. #
# Parameters understood by this plugin #
# #
# config (required) #
# autoconf (optional) #
# #
###################################################################
# This plgin works with postgrey 1.31 but should also do with 1.32#
# Tested under Debian lenny #
###################################################################
### Author Rico Sagner hellriegel@sund-xplosion.de
### Please send bug reports to this address
use strict;
use warnings;
my $maillog= $ENV{'logfile'} || "/var/log/mail.log";
my $statefile= $ENV{'statefile'} || "/var/lib/munin/plugin-state/postgrey-new.state";
my $greylisted=0;
my $greylisted_old=0;
my $passes=0;
my $passes_old=0;
my $passes_white=0;
my $passes_white_old=0;
my $retry=0;
my $retry_old=0;
my $grey_new=0;
my $pass_new=0;
my $retry_new=0;
my $passes_white_new=0;
if(defined $ARGV[0] and $ARGV[0] eq "autoconf") {
if ( -f $maillog) {
print "yes\n";
exit 0;
}
else {
print "no\n";
exit 1
}
}
if(defined $ARGV[0] and $ARGV[0] eq "config") {
print "graph_title Postgrey Actions\n";
print "graph_order greylisted retry_early passed passed_w\n";
print "graph_category mail\n";
print "graph_vlabel Count\n";
print "graph_scale no\n";
print "greylisted.label greylisted_reason_new\n";
print "greylisted.type GAUGE\n";
print "greylisted.draw AREA\n";
print "greylisted.min 0\n";
print "retry_early.label greylisted_retry_early\n";
print "retry_early.type GAUGE\n";
print "retry_early.draw AREA\n";
print "retry_early.min 0\n";
print "passed.label passed_found\n";
print "passed.type GAUGE\n";
print "passed.draw AREA\n";
print "passed.min 0\n";
print "passed_w.label passed_whitelisted\n";
print "passed_w.type GAUGE\n";
print "passed_w.draw AREA\n";
print "passed_w.min 0\n";
exit 0;
}
if( -f $statefile) {
open ( STATE ,"<$statefile");
defined($greylisted_old=<STATE>) or $greylisted_old=0;
defined($passes_old=<STATE>) or $passes_old=0;
defined($retry_old=<STATE>) or $retry_old=0;
defined($passes_white_old=<STATE>) or $passes_white_old=0;
chomp($greylisted_old);
chomp($passes_old);
chomp($retry_old);
chomp($passes_white_old);
close STATE;
}
open (LOG ,"<$maillog") or die "Cannot open Maillog";
while(my $line = <LOG>)
{
if($line=~m/postgrey\[/)
{
if($line=~m/action=greylist/) {
if($line=~m/reason=new/)
{
$greylisted++;
}
elsif($line=~m/reason=early-retry/)
{
$retry++;
}
}
elsif($line=~m/action=pass/) {
if($line=~m/reason=triplet/)
{
$passes++;
}
elsif($line=~m/reason=client/)
{
$passes_white++;
}
}
}
}
close(LOG);
open (STATE2,">$statefile");
print STATE2 "$greylisted\n";
print STATE2 "$passes\n";
print STATE2 "$retry\n";
print STATE2 "$passes_white\n";
close STATE2;
if($greylisted_old>$greylisted) { $grey_new=$greylisted; }
elsif($greylisted_old eq $greylisted) { $grey_new=0;}
else { $grey_new=$greylisted-$greylisted_old; }
if($passes_old>$passes) { $pass_new=$passes;}
elsif( $passes_old eq $passes) { $pass_new=0; }
else { $pass_new=$passes-$passes_old; }
if($retry_old>$retry) { $retry_new=$retry;}
elsif($retry_old eq $retry) { $retry_new=0;}
else { $retry_new=$retry-$retry_old; }
if($passes_white_old>$passes_white) { $passes_white_new=$passes_white;}
elsif($passes_white_old eq $passes_white) { $passes_white_new=0;}
else { $passes_white_new=$passes_white-$passes_white_old; }
print "greylisted.value $grey_new\n";
print "retry_early.value $retry_new\n";
print "passed.value $pass_new\n";
print "passed_w.value $passes_white_new\n";
exit 0;

103
plugins/mail/procmail_ Executable file
View file

@ -0,0 +1,103 @@
#!/usr/bin/perl
use strict;
use warnings;
use YAML;
my (%conf, $state, $have_read, $totlines);
%conf = (logfile => $ENV{LOGFILE} || '/home/user/.procmail/log',
state => $ENV{STATEFILE} || '/var/lib/munin/plugin-state/munin-plugin-procmail.state');
$state = YAML::LoadFile($conf{state});
$have_read = 0;
unless (-f $conf{logfile} and -r $conf{logfile}) {
die "$conf{logfile} does not exist or is not readable!" ;
}
if (@ARGV and $ARGV[0] eq 'autoconf') {
print "yes\n";
} elsif (@ARGV and $ARGV[0] eq 'config') {
print config();
} else {
print fetch();
# Update the offset, clear the numbers - Only when fetching!
$state->{offset} += $have_read;
$state->{folders}{$_} = 0 foreach keys %{$state->{folders}};
}
YAML::DumpFile($conf{state}, $state);
exit 0;
sub config {
# If config is ever called without having first a successful run, it should not die!
$state->{folders} ||= {};
print "graph_title Destination folders for Postfix\n",
"graph_vlabel Received mails\n",
"graph_category Mail\n",
"graph_info Gives you the total mails stored by Postfix by folder\n";
print "$_.label $_\n" foreach sort keys %{$state->{folders}};
}
sub fetch {
my ($fh);
if ($fh = open_log()) {
$state->{folders} ||= {};
while (my $folder = next_used_folder($fh)) {
$state->{folders}{$folder}++;
}
}
print "$_.value $state->{folders}{$_}\n" foreach sort keys %{$state->{folders}};
}
sub next_used_folder {
my ($fh);
$fh = shift;
while (my $lin = <$fh>) {
$have_read++;
next unless $lin =~ m!^\s*Folder: ([^\s/]+)!;
next unless $1;
return $1;
}
return undef;
}
sub open_log {
my ($fh, $offset, $lines_to_read);
$offset = get_log_offset();
get_log_size();
$lines_to_read = $totlines - $offset;
open($fh, "tail -$lines_to_read $conf{logfile}|") or die $!;
return $fh;
}
sub get_log_size {
my $tot = `wc -l $conf{logfile}`;
$tot =~ /^(\d+) /;
return $totlines = $1;
}
sub get_log_offset {
my ($size);
# The offset is expressed as the number of lines to skip. We get to that
# point getting the total log size (get_log_size) and using tail for the
# difference. If the offset is larger than the file itself, we get it
# whole (it might have just been rotated).
$size = get_log_size();
$state->{offset} ||= 0;
$state->{offset} = 0 if $size < $state->{offset};
return $state->{offset};
}
sub hush {
return unless $ENV{FOLLOW};
warn @_;
}

42
plugins/mail/qmailconn Executable file
View file

@ -0,0 +1,42 @@
#!/bin/sh
#
# Plugin to show amount of smtp-connections per hour
#
# Contributed by Håkon Nessjøen <lunatic@cpan.org>
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Qmail SMTP connections'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel connections/hour'
echo 'graph_category Mail'
echo 'graph_order rbl accepted total'
echo 'rbl.label RBL rejected connections'
echo 'rbl.min 0'
echo 'rbl.draw AREA'
echo 'accepted.label Accepted connections'
echo 'accepted.min 0'
echo 'accepted.draw STACK'
echo 'total.label Total connections'
echo 'total.min 0'
echo 'total.draw LINE1'
exit 0
fi
rbl=`cat /var/log/qmail/smtpd/@* /var/log/qmail/smtpd/current | grep -c rblsmtp`
accepted=`cat /var/log/qmail/smtpd/@* /var/log/qmail/smtpd/current | grep -c 'tcpserver: ok'`
echo -n "rbl.value " && ( echo $rbl || echo U )
echo -n "accepted.value " && ( echo $accepted || echo U )
echo "total.value $[$rbl + $accepted]"

97
plugins/mail/qmailsend Executable file
View file

@ -0,0 +1,97 @@
#!/usr/bin/perl -w
#
# Plugin to show amount of individual outgoing smtp-replies per hour
#
# Contributed by Håkon Nessjøen <lunatic@cpan.org>
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
use strict;
my $logpath = $ENV{'logpath'} || '/var/log/mail/';
if (exists $ARGV[0]) {
if ($ARGV[0] eq "autoconf") {
if (-f "${logpath}current") {
print "yes\n";
exit 0;
} else {
print STDERR "no (Cannot find ${logpath}current. Please specify env.logpath)\n";
exit 1;
}
}
}
my %responses;
# '453' => 'You have no mail (atrn)',
# '503' => 'Bad sequence of commands',
my %descriptions = (
'250' => 'Mail delivery ok',
'421' => 'Service unavail or timeout',
'441' => 'No established connection',
'442' => 'Connection Died',
'450' => 'Mbox unavail or greylist',
'451' => 'Err processing or greylist',
'452' => 'Insufficient storage space',
'454' => 'TLS not available now',
'472' => 'DNS transaction timeout',
'500' => 'Unsolicited mail',
'501' => 'Syntax error',
'511' => 'Blocked or blacklisted',
'522' => 'Mailbox full',
'550' => 'Mailbox unavailable',
'551' => 'User not local',
'552' => 'Content or storage error',
'553' => 'Mailbox name not allowed',
'554' => 'Session failed or blocked',
'557' => 'Too many duplicate msgs'
);
#open(DATA,"cat ${logpath}current $logpath\@* | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort | uniq -c|");
open(DATA,"grep -E '_\\(\\#4\\.4\\.1\\)|_\\(\\#4\\.4\\.2\\)|Remote_host_said:_' ${logpath}current | sed 's/_(\\#4\\.4\\.1)/\\/Remote_host_said:_441_/; s/_(\\#4\\.4\\.2)/\\/Remote_host_said:_442_/' | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort -n | uniq -c|");
while (<DATA>) {
if (m/\s*(\d+)\s+(\d+)/) {
$responses{$2} = $1;
}
}
close(DATA);
if (exists $ARGV[0]) {
if ($ARGV[0] eq 'config') {
print "graph_title Qmail outgoing SMTP replies\n";
print "graph_args --base 1000 -l 0 \n";
print "graph_vlabel replies/hour\n";
print "graph_category Mail\n";
print "graph_total Total\n" if (keys (%descriptions) > 1);
print "graph_info This graph shows qmail-send transaction response codes.\n";
print "graph_order res" . join(" res", sort by_code keys %descriptions) . "\n";
foreach (sort by_code keys %descriptions) {
my $name = 'res' . $_;
print "$name.label ";
print $_." ".$descriptions{$_}."\n";
print "$name.min 0\n";
print "$name.draw LINE1\n";
}
exit;
}
}
foreach (sort by_code keys %descriptions) {
#print "res$_.value ".int($responses{$_})."\n";
if (exists $responses{$_}) {
print "res$_.value $responses{$_}\n";
}else{
print "res$_.value 0\n";
}
}
sub by_code {
return $a cmp $b;
}

97
plugins/mail/qmailsend_plesk Executable file
View file

@ -0,0 +1,97 @@
#!/usr/bin/perl -w
#
# Plugin to show amount of individual outgoing smtp-replies per hour
#
# Contributed by Håkon Nessjøen <lunatic@cpan.org>
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
use strict;
my $logpath = $ENV{'logpath'} || '/usr/local/psa/var/log/';
if (exists $ARGV[0]) {
if ($ARGV[0] eq "autoconf") {
if (-f "${logpath}maillog") {
print "yes\n";
exit 0;
} else {
print STDERR "no (Cannot find ${logpath}maillog. Please specify env.logpath)\n";
exit 1;
}
}
}
my %responses;
# '453' => 'You have no mail (atrn)',
# '503' => 'Bad sequence of commands',
my %descriptions = (
'250' => 'Mail delivery ok',
'421' => 'Service unavail or timeout',
'441' => 'No established connection',
'442' => 'Connection Died',
'450' => 'Mbox unavail or greylist',
'451' => 'Err processing or greylist',
'452' => 'Insufficient storage space',
'454' => 'TLS not available now',
'472' => 'DNS transaction timeout',
'500' => 'Unsolicited mail',
'501' => 'Syntax error',
'511' => 'Blocked or blacklisted',
'522' => 'Mailbox full',
'550' => 'Mailbox unavailable',
'551' => 'User not local',
'552' => 'Content or storage error',
'553' => 'Mailbox name not allowed',
'554' => 'Session failed or blocked',
'557' => 'Too many duplicate msgs'
);
#open(DATA,"cat ${logpath}maillog $logpath\@* | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort | uniq -c|");
open(DATA,"grep -E '_\\(\\#4\\.4\\.1\\)|_\\(\\#4\\.4\\.2\\)|Remote_host_said:_' ${logpath}maillog | sed 's/_(\\#4\\.4\\.1)/\\/Remote_host_said:_441_/; s/_(\\#4\\.4\\.2)/\\/Remote_host_said:_442_/' | perl -ne'm/Remote_host_said:_(\\d+)/ && print \$1.\"\n\";' | sort -n | uniq -c|");
while (<DATA>) {
if (m/\s*(\d+)\s+(\d+)/) {
$responses{$2} = $1;
}
}
close(DATA);
if (exists $ARGV[0]) {
if ($ARGV[0] eq 'config') {
print "graph_title Qmail outgoing SMTP replies\n";
print "graph_args --base 1000 -l 0 \n";
print "graph_vlabel replies/hour\n";
print "graph_category Mail\n";
print "graph_total Total\n" if (keys (%descriptions) > 1);
print "graph_info This graph shows qmail-send transaction response codes.\n";
print "graph_order res" . join(" res", sort by_code keys %descriptions) . "\n";
foreach (sort by_code keys %descriptions) {
my $name = 'res' . $_;
print "$name.label ";
print $_." ".$descriptions{$_}."\n";
print "$name.min 0\n";
print "$name.draw LINE1\n";
}
exit;
}
}
foreach (sort by_code keys %descriptions) {
#print "res$_.value ".int($responses{$_})."\n";
if (exists $responses{$_}) {
print "res$_.value $responses{$_}\n";
}else{
print "res$_.value 0\n";
}
}
sub by_code {
return $a cmp $b;
}

29
plugins/mail/qremote Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
#
# Plugin to count the qmail-remote processes
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo "yes"
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Qmail-remote processes
graph_args --base 1000 -l 0
graph_vlabel running processes
graph_category Mail
remote.label remote
remote.type GAUGE
EOT
exit 0
fi
echo -n "remote.value " && pgrep qmail-remote | wc -l

30
plugins/mail/queuestats Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
#
# Plugin to count the qmail queue
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo "yes"
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Qmail queue stats
graph_args --base 1000 -l 0
graph_vlabel mails in queue
graph_category Mail
queue.label queue
queue.type GAUGE
queue.min 0
EOT
exit 0
fi
echo -n "queue.value " && /usr/bin/find $queue/mess/ -type f -print | /usr/bin/wc -l

75
plugins/mail/sa-learn Executable file
View file

@ -0,0 +1,75 @@
#!/bin/bash
: <<=cut
=head1 NAME
sa-learn - Munin plugin to monitor spamassasin bayes database size
=head1 APPLICABLE SYSTEMS
Any server running spamassassin
=head1 CONFIGURATION
This plugin assumes your Spamassassin database is in /var/lib/MailScanner.
If it's elsewhere (or you want to use a different database) you will need
a configuration such as:
[sa-learn]
env.BayesDir /path/to/bayes/directory/
user mail
(where 'user mail' refers to a user that can read the database).
=head1 MAGIC MARKERS
#%# family=contrib
=head1 VERSION
2
=head1 AUTHOR
Paul Saunders L<darac+munin@darac.org.uk>
=cut
#'
case $1 in
config)
cat <<'EOM'
graph_title SA-Learn Magic
graph_vlabel Count
graph_args --base 1000 -l 0
graph_category Mail
spam.label Num Spam
spam.type GAUGE
ham.label Num Ham
ham.type GAUGE
tokens.label Num Tokens
tokens.type GAUGE
EOM
exit 0;;
esac
## Print values
BayesDir=${BayesDir:-/var/lib/MailScanner}
sa-learn --dbpath $BayesDir/ --dump magic 2>/dev/null | while read line
do
case "$line" in
*nspam*)
echo -n "spam.value "
echo $line | awk '{print $3}'
;;
*nham*)
echo -n "ham.value "
echo $line | awk '{print $3}'
;;
*ntokens*)
echo -n "tokens.value "
echo $line | awk '{print $3}'
;;
esac
done

View file

@ -0,0 +1,80 @@
#!/usr/bin/env python
# Copyright (c) 2008, Net Easy, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Net Easy, Inc. nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY Net Easy, Inc. ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Net Easy, Inc. BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# requires logcheck from ports
import re, os
from sys import argv
logfile = "/var/log/daemon"
blacklists = ['spews1', 'spews2', 'uatraps', 'nixspam']
class checker(object):
def __init__(self, blacklist):
self.grey = 0
self.black = 0
self.blacklist_count = {}
for item in blacklist:
self.blacklist_count[item] = 0
def __repr__(self):
string = """grey.value %s
black.value %s""" % (self.grey, self.black)
for item in self.blacklist_count.keys():
string = "%s\n%s.value %s" % (string, item, self.blacklist_count[item])
return string
def process_line(self, line):
if re.search('(BLACK)', line):
self.black += 1
if re.search('(GREY)', line):
self.grey += 1
if re.search(' lists: ', line):
if re.search(' connected', line): # only log connects
spamtraps = re.sub('^.*lists:', '', line).split()
for item in spamtraps:
self.blacklist_count[item] += 1
def process_lines(self, file):
for line in os.popen('logtail %s %s.bl.offset' % (file, file)).readlines():
self.process_line(line)
if __name__ == "__main__":
if len(argv) > 1 and argv[1] == 'config':
print """graph_title spamd
graph_vlabel Count / 5 min.
graph_category Mail
graph_info Number of greylisted and blacklisted connections to the OpenBSD spamd tarpit, and the hits on each blacklist
grey.label Greylisted
black.label Blacklisted"""
for item in blacklists:
print "%s.label Blacklist %s hits" % (item, item)
else:
processor = checker(blacklists)
processor.process_lines(logfile)
print processor

71
plugins/mail/spamd-tarpit-bsd Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env python
# Copyright (c) 2008, Net Easy, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Net Easy, Inc. nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY Net Easy, Inc. ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Net Easy, Inc. BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# requires logcheck from ports
import re, os
from sys import argv
logfile = "/var/log/daemon"
class checker(object):
def __init__(self):
self.tarpit_count = 0
self.tarpit_total = 0
def __repr__(self):
return "tarpit.value %s" % (self.tarpit_average())
def tarpit_average(self):
if self.tarpit_count > 0:
return "%.1f" % (self.tarpit_total / self.tarpit_count)
else:
return 0
def process_line(self, line):
if re.search(' disconnected after ', line):
self.tarpit_count += 1
tarpit_time = re.sub('^.*after ','',re.sub(' second.*$','',line))
self.tarpit_total += int(tarpit_time)
def process_lines(self, file):
for line in os.popen('logtail %s %s.tp.offset' % (file, file)).readlines():
self.process_line(line)
if __name__ == "__main__":
if len(argv) > 1 and argv[1] == 'config':
print """graph_title spamd delay
graph_vlabel Average delay.
graph_category Mail
graph_info Average time spammers delayed by spamd
tarpit.label Average tarpit delay"""
else:
processor = checker()
processor.process_lines(logfile)
print processor

214
plugins/mail/spamdyke Executable file
View file

@ -0,0 +1,214 @@
#!/bin/bash
#
# Plugin to monitor spamdyke
#
# Spamdyke logs expected to be inside /var/log/mail.info
# logtail must be installed
# Plugin state stored in /var/lib/munin/plugin-state
# (statedir as defined in munin debian packages)
#
# You may override spamdyke logfile in plugin-conf.d/munin-node, and
# give the user/group with enough rights to read your logs (group
# adm on stock debian works fine)
#
# [spamdyke]
# env.logfile /var/log/maillog
# group adm
#
#
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
mktempfile () {
mktemp -t
}
MAIL_LOG=${logfile:-/var/log/mail.info}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/spamdyke.offset
if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title spamdyke filtering'
echo 'graph_category mail'
echo 'graph_vlabel Count'
echo 'graph_args --base 1000 -l 0'
echo 'graph_total total'
echo 'allowed.label ALLOWED'
echo 'allowed.info The message passed all filters. qmail may still bounce the message for other reasons, however. '
echo 'allowed.min 1'
echo 'allowedauthenticated.label ALLOWED_AUTHENTICATED'
echo 'allowedauthenticated.info The remote client successfully authenticated using SMTP AUTH with spamdyke. If qmail is patched to provide SMTP AUTH, this code will never be used '
echo 'allowedauthenticated.min 1'
echo 'allowedtls.label ALLOWED_TLS'
echo 'allowedtls.info The remote client successfully started a TLS session with spamdyke '
echo 'allowedtls.min 1'
echo 'timeout.label TIMEOUT'
echo 'timeout.info The connection timed out, either in total time ("connection-timeout-secs") or idle time ("idle-timeout-secs"). If the connection was already being blocked for another reason, the code for that error is given as REALCODE '
echo 'timeout.min 1'
echo 'deniedtoomanyrecipients.label DENIED_TOO_MANY_RECIPIENTS'
echo 'deniedtoomanyrecipients.info The recipient was blocked because the limit ("max-recipients") was reached for this connection. The SMTP connection continues after this error occurs'
echo 'deniedtoomanyrecipients.min 1'
echo 'deniedunqualifiedrecipient.label DENIED_UNQUALIFIED_RECIPIENT'
echo 'deniedunqualifiedrecipient.info The recipient was blocked because the address had no domain name. The SMTP connection continues after this error occurs'
echo 'deniedunqualifiedrecipient.min 1'
echo 'deniedgraylisted.label DENIED_GRAYLISTED'
echo 'deniedgraylisted.info recipient was blocked because the sender/recipient combination was graylisted '
echo 'deniedgraylisted.min 1'
echo 'deniedrdnsmissing.label DENIED_RDNS_MISSING'
echo 'deniedrdnsmissing.info The connection was blocked because the remote server has no rDNS name at all'
echo 'deniedrdnsmissing.min 1'
echo 'deniedrdnsresolve.label DENIED_RDNS_RESOLVE'
echo 'deniedrdnsresolve.info The connection was blocked because the remote servers rDNS name does not resolve '
echo 'deniedrdnsresolve.min 1'
echo 'deniedipinccrdns.label DENIED_IP_IN_CC_RDNS'
echo 'deniedipinccrdns.info The connection was blocked because the remote servers IP address was found in the remote servers rDNS name _and_ the remote servers rDNS name ends in a country code ("reject-ip-in-cc-rdns"). '
echo 'deniedipinccrdns.min 1'
echo 'deniedipinrdns.label DENIED_IP_IN_RDNS'
echo 'deniedipinrdns.info The connection was blocked because the remote servers IP address was found in the remote servers rDNS name _and_ a prohibited keyword was found in the remote servers rDNS name ("ip-in-rdns-keyword-file"). '
echo 'deniedipinrdns.min 1'
echo 'deniedearlytalker.label DENIED_EARLYTALKER'
echo 'deniedearlytalker.info The connection was blocked because the remote server began sending data before the SMTP greeting was issued ("greeting-delay-secs"). '
echo 'deniedearlytalker.min 1'
echo 'deniedblacklistname.label DENIED_BLACKLIST_NAME'
echo 'deniedblacklistname.info The connection was blocked because the base domain of the remote servers rDNS name is blacklisted ("rdns-blacklist-file" or "rdns-blacklist-dir"). '
echo 'deniedblacklistname.min 1'
echo 'deniedblacklistip.label DENIED_BLACKLIST_IP'
echo 'deniedblacklistip.info The connection was blocked because the remote servers IP address is blacklisted ("ip-blacklist-file"). '
echo 'deniedblacklistip.min 1'
echo 'deniedsenderblacklisted.label DENIED_SENDER_BLACKLISTED'
echo 'deniedsenderblacklisted.info The connection was blocked because the senders email address is blacklisted ("sender-blacklist-file"). '
echo 'deniedsenderblacklisted.min 1'
echo 'deniedrecipientblacklisted.label DENIED_RECIPIENT_BLACKLISTED'
echo 'deniedrecipientblacklisted.info The recipient was blocked because the recipient email address is blacklisted ("recipient-blacklist-file"). '
echo 'deniedrecipientblacklisted.min 1'
echo 'deniedrblmatch.label DENIED_RBL_MATCH'
echo 'deniedrblmatch.info The connection was blocked because the remote servers IP address was found on a DNS RBL ("check-dnsrbl"). '
echo 'deniedrblmatch.min 1'
echo 'deniedrhsblmatch.label DENIED_RHSBL_MATCH'
echo 'deniedrhsblmatch.info The connection was blocked because the remote servers reverse DNS name was found on a righthand-side DNS blacklist (RHSBL) OR the connection was blocked because the senders domain name was found on a righthand-side DNS blacklist (RHSBL). '
echo 'deniedrhsblmatch.min 1'
echo 'deniedsendernomx.label DENIED_SENDER_NO_MX'
echo 'deniedsendernomx.info The connection was blocked because the senders domain has no mail exchanger, making the sender address invalid'
echo 'deniedsendernomx.min 1'
echo 'deniedccessdenied.label DENIED_ACCESS_DENIED'
echo 'deniedaccessdenied.info The connection was blocked because the remote servers IP address or rDNS name was found in the access file with a "deny" command ("access-file"). '
echo 'deniedccessdenied.min 1'
echo 'deniedrelaying.label DENIED_RELAYING'
echo 'deniedrelaying.info The recipient was blocked because the recipients domain is not locally hosted ("local-domains-file") and the remote server is not allowed to relay ("access-file"). '
echo 'deniedrelaying.min 1'
echo 'deniedother.label DENIED_OTHER'
echo 'deniedother.info The connection was rejected by qmail (or another downstream filter), not spamdyke. '
echo 'deniedother.min 1'
echo 'failedauth.label FAILED_AUTH'
echo 'failedauth.info The remote server attempted to authenticate but the given username and/or password were incorrect ("smtp-auth-command" or "smtp-auth-command-encryption"). '
echo 'failedauth.min 1'
echo 'unknownauth.label UNKNOWN_AUTH'
echo 'unknownauth.info The remote server requested an authentication method spamdyke doesnt support. This shouldnt happen. '
echo 'unknownauth.min 1'
echo 'failedtls.label FAILED_TLS'
echo 'failedtls.info The remote client attempted to start a TLS session but SSL negotiation failed.'
echo 'failedtls.min 1'
exit 0
fi
allowed=u
allowedauthenticated=u
allowedtls=u
timeout=u
deniedtoomanyrecipients=U
deniedunqualifiedrecipient=U
deniedgraylisted=U
deniedrdnsmissing=U
deniedrdnsresolve=U
deniedipinccrdns=U
deniedipinrdns=U
deniedearlytalker=U
deniedblacklistname=U
deniedblacklistip=U
deniedsenderblacklisted=U
deniedrecipientblacklisted=U
deniedrblmatch=U
deniedrhsblmatch=U
deniedsendernomx=U
deniedccessdenied=U
deniedrelaying=U
deniedother=U
failedauth=U
unknownauth=U
failedtls=U
TEMP_FILE=`mktempfile munin.spamdyke.XXXXXX`
if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
$LOGTAIL ${MAIL_LOG} $STATEFILE | grep "spamdyke\[.*\]:" > ${TEMP_FILE}
allowed=`grep 'spamdyke\[[0-9\]*]: ALLOWED' ${TEMP_FILE} | wc -l`
allowedauthenticated=`grep 'spamdyke\[[0-9]*\]: ALLOWED_AUTHENTICATED' ${TEMP_FILE} | wc -l`
allowedtls=`grep 'spamdyke\[[0-9]\]: ALLOWED_TLS' ${TEMP_FILE} | wc -l`
timeout=`grep 'spamdyke\[[0-9]*\]: TIMEOUT' ${TEMP_FILE} | wc -l`
deniedtoomanyrecipients=`grep 'spamdyke\[[0-9]*\]: DENIED_TOO_MANY_RECIPIENTS' ${TEMP_FILE} | wc -l`
deniedunqualifiedrecipient=`grep 'spamdyke\[[0-9]*\]: DENIED_UNQUALIFIED_RECIPIENT' ${TEMP_FILE} | wc -l`
deniedgraylisted=`grep 'spamdyke\[[0-9]*\]: DENIED_GRAYLISTED' ${TEMP_FILE} | wc -l`
deniedrdnsmissing=`grep 'spamdyke\[[0-9]*\]: DENIED_RDNS_MISSING' ${TEMP_FILE} | wc -l`
deniedrdnsresolve=`grep 'spamdyke\[[0-9]*\]: DENIED_RDNS_RESOLVE' ${TEMP_FILE} | wc -l`
deniedipinccrdns=`grep 'spamdyke\[[0-9]*\]: DENIED_IP_IN_CC_RDNS' ${TEMP_FILE} | wc -l`
deniedipinrdns=`grep 'spamdyke\[[0-9]*\]: DENIED_IP_IN_RDNS' ${TEMP_FILE} | wc -l`
deniedearlytalker=`grep 'spamdyke\[[0-9]*\]: DENIED_EARLYTALKER' ${TEMP_FILE} | wc -l`
deniedblacklistname=`grep 'spamdyke\[[0-9]*\]: DENIED_BLACKLIST_NAME' ${TEMP_FILE} | wc -l`
deniedblacklistip=`grep 'spamdyke\[[0-9]*\]: DENIED_BLACKLIST_IP' ${TEMP_FILE} | wc -l`
deniedsenderblacklisted=`grep 'spamdyke\[[0-9]*\]: DENIED_SENDER_BLACKLISTED' ${TEMP_FILE} | wc -l`
deniedrecipientblacklisted=`grep 'spamdyke\[[0-9]*\]: DENIED_RECIPIENT_BLACKLISTED' ${TEMP_FILE} | wc -l`
deniedrblmatch=`grep 'spamdyke\[[0-9]*\]: DENIED_RBL_MATCH' ${TEMP_FILE} | wc -l`
deniedrhsblmatch=`grep 'spamdyke\[[0-9]*\]: DENIED_RHSBL_MATCH' ${TEMP_FILE} | wc -l`
deniedsendernomx=`grep 'spamdyke\[[0-9]*\]: DENIED_SENDER_NO_MX' ${TEMP_FILE} | wc -l`
deniedccessdenied=`grep 'spamdyke\[[0-9]*\]: DENIED_ACCESS_DENIED' ${TEMP_FILE} | wc -l`
deniedrelaying=`grep 'spamdyke\[[0-9]*\]: DENIED_RELAYING' ${TEMP_FILE} | wc -l`
deniedother=`grep 'spamdyke\[[0-9]*\]: DENIED_OTHER' ${TEMP_FILE} | wc -l`
failedauth=`grep 'spamdyke\[[0-9]*\]: FAILED_AUTH' ${TEMP_FILE} | wc -l`
unknownauth=`grep 'spamdyke\[[0-9]*\]: UNKNOWN_AUTH' ${TEMP_FILE} | wc -l`
failedtls=`grep 'spamdyke\[[0-9]*\]: FAILED_TLS' ${TEMP_FILE} | wc -l`
/bin/rm -f $TEMP_FILE
fi
echo "allowed.value ${allowed}"
echo "allowedauthenticated.value ${allowedauthenticated}"
echo "allowedtls.value ${allowedtls}"
echo "timeout.value ${timeout}"
echo "deniedtoomanyrecipients.value ${deniedtoomanyrecipients}"
echo "deniedunqualifiedrecipient.value ${deniedunqualifiedrecipient}"
echo "deniedgraylisted.value ${deniedgraylisted}"
echo "deniedrdnsmissing.value ${deniedrdnsmissing}"
echo "deniedrdnsresolve.value ${deniedrdnsresolve}"
echo "deniedipinccrdns.value ${deniedipinccrdns}"
echo "deniedipinrdns.value ${deniedipinrdns}"
echo "deniedearlytalker.value ${deniedearlytalker}"
echo "deniedblacklistname.value ${deniedblacklistname}"
echo "deniedblacklistip.value ${deniedblacklistip}"
echo "deniedsenderblacklisted.value ${deniedsenderblacklisted}"
echo "deniedrecipientblacklisted.value ${deniedrecipientblacklisted}"
echo "deniedrblmatch.value ${deniedrblmatch}"
echo "deniedrhsblmatch.value ${deniedrhsblmatch}"
echo "deniedsendernomx.value ${deniedsendernomx}"
echo "deniedccessdenied.value ${deniedccessdenied}"
echo "deniedrelaying.value ${deniedrelaying}"
echo "deniedother.value ${deniedother}"
echo "failedauth.value ${failedauth}"
echo "unknownauth.value ${unknownauth}"
echo "failedtls.value ${failedtls}"