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

Merge pull request #246 from ufoonline/patch-1

Update plugins/mail/qmailconn
This commit is contained in:
Kenyon Ralph 2013-02-02 20:07:42 -08:00
commit 52d82e6b2f

View File

@ -2,7 +2,11 @@
# #
# Plugin to show amount of smtp-connections per hour # Plugin to show amount of smtp-connections per hour
# #
# Contributed by Håkon Nessjøen <lunatic@cpan.org> # 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
# #
# Magic markers - optional - used by installation scripts and # Magic markers - optional - used by installation scripts and
# munin-config: # munin-config:
@ -10,6 +14,9 @@
#%# family=manual #%# family=manual
#%# capabilities=autoconf #%# capabilities=autoconf
# get: env.logpath
LOGPATH=${logpath:-/var/log/qmail/qmail-smtpd/}
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
@ -17,26 +24,41 @@ fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Qmail SMTP connections' echo 'graph_title Qmail SMTP connections'
echo 'graph_args --base 1000 -l 0 ' echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel connections/hour' echo 'graph_vlabel connections/hour'
echo 'graph_category Mail' echo 'graph_category mail'
echo 'graph_order rbl accepted total' echo 'graph_order rbl greylisted accepted simscan_spam simscan_virus total'
echo 'rbl.label RBL rejected connections' echo 'rbl.label RBL rejected connections'
echo 'rbl.min 0' echo 'rbl.min 0'
echo 'rbl.draw AREA' echo 'rbl.draw AREA'
echo 'accepted.label Accepted connections' echo 'greylisted.label Greylisted connections'
echo 'accepted.min 0' echo 'greylisted.min 0'
echo 'accepted.draw STACK' echo 'greylisted.draw STACK'
echo 'total.label Total connections' echo 'accepted.label Accepted connections'
echo 'total.min 0' echo 'accepted.min 0'
echo 'total.draw LINE1' 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'
exit 0 exit 0
fi fi
rbl=`cat /var/log/qmail/smtpd/@* /var/log/qmail/smtpd/current | grep -c rblsmtp` rbl=`cat $LOGPATH/@* $LOGPATH/current | grep -c rblsmtp`
accepted=`cat /var/log/qmail/smtpd/@* /var/log/qmail/smtpd/current | grep -c 'tcpserver: ok'` 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"`
echo -n "rbl.value " && ( echo $rbl || echo U ) echo -n "rbl.value " && ( echo $rbl || echo U )
echo -n "accepted.value " && ( echo $accepted || echo U ) echo -n "accepted.value " && ( echo $accepted || echo U )
echo "total.value $[$rbl + $accepted]" 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)"