2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/mail/qmailconn

65 lines
2.1 KiB
Plaintext
Raw Normal View History

2007-02-13 07:19:31 +01:00
#!/bin/sh
#
# Plugin to show amount of smtp-connections per hour
#
# Contributed by H<>kon Nessj<73>en <lunatic@cpan.org>
#
# Modified by Massimiliano Cianelli <massimiliano@cianelli.eu>
# 2013-02-02 - Added support for Greylist and simscan Virus\Spam detect
# Added LOGPATH env var
2007-02-13 07:19:31 +01:00
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
# get: env.logpath
LOGPATH=${logpath:-/var/log/qmail/qmail-smtpd/}
2007-02-13 07:19:31 +01:00
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 greylisted accepted simscan_spam simscan_virus total'
echo 'rbl.label RBL rejected connections'
echo 'rbl.min 0'
echo 'rbl.draw AREA'
echo 'greylisted.label Greylisted connections'
echo 'greylisted.min 0'
echo 'greylisted.draw STACK'
echo 'accepted.label Accepted connections'
echo 'accepted.min 0'
echo 'accepted.draw STACK'
echo 'simscan_spam.label Rejected SPAM'
echo 'simscan_spam.min 0'
echo 'simscan_spam.draw STACK'
echo 'simscan_virus.label Rejected VIRUS'
echo 'simscan_virus.min 0'
echo 'simscan_virus.draw STACK'
echo 'total.label Total connections'
echo 'total.min 0'
echo 'total.draw LINE1'
2007-02-13 07:19:31 +01:00
exit 0
fi
rbl=`cat $LOGPATH/@* $LOGPATH/current | grep -c rblsmtp`
accepted=`cat $LOGPATH/@* $LOGPATH/current | grep -c 'tcpserver: ok'`
greylisted=`cat $LOGPATH/@* $LOGPATH/current | grep -ce "jgreylist\[[[:digit:]]\+\]: .\+\: GREY"`
simscan_spam=`cat $LOGPATH/@* $LOGPATH/current | grep -ce "simscan:\[[[:digit:]]\+\]:SPAM"`
simscan_virus=`cat $LOGPATH/@* $LOGPATH/current | grep -ce "simscan:\[[[:digit:]]\+\]:VIRUS"`
2007-02-13 07:19:31 +01:00
echo -n "rbl.value " && ( echo $rbl || echo U )
echo -n "accepted.value " && ( echo $accepted || echo U )
echo -n "greylisted.value " && ( echo $greylisted || echo U )
echo -n "simscan_spam.value " && ( echo $simscan_spam || echo U )
echo -n "simscan_virus.value " && ( echo $simscan_virus || echo U )
echo "total.value $(expr $rbl + $accepted + $greylisted)"