#!/bin/sh countfile=/tmp/rblblocking_unique date=$(date "+%b %e") grep "Spam blocked see:" /var/log/maillog 2> /dev/null | grep "^$date" | \ sed 's~^\([a-zA-Z]* [0-9]* [0-9]*:[0-9]*:[0-9]* \).*Spam blocked see: ~\1~' | \ sort >> $countfile grep "^$date" $countfile | sort -u > $countfile.2 mv $countfile.2 $countfile num=$(wc -l $countfile | awk {'print $1'}) num=$(($num + 0)) uniq=$(awk {'print $4'} $countfile | uniq | wc -l | awk {'print $1'}) uniq=$(($uniq + 0)) echo $num echo $uniq uptime | awk {'print $3" "$4" "$5'} | sed s~,$~~ hostname # # This script counts the RBL Kills from the maillog on most servers (that reports mail # entries to a log (/var/log/maillog - changeable). This script also attempts to count # UNIQUE kills & TOTAL kills ... and on a daily basis - numbers are reset each day. # Used with MRTG, to produce the 4 output entries on a seperate line as required by MRTG # written by Kul (http://scripts.akakul.co.uk/) (c)2004 # Ideally the maillog should not be too large or this could take a while to run # if it is large I recommend you read the MRTG man pages and look into using "Fork" # as it dramatically improves the time taken to complete the whole mrtg set of process. # Although rotating the mail log daily would be nicer :-) #