From f7a9f484060ee886ee1ac82d45db7134839fa408 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Fri, 15 Jun 2018 15:21:12 +1000 Subject: [PATCH] added the base exim scanner --- email-tools/eximlogger/localdomains | 1 + email-tools/eximlogger/statsbyaddress.sh | 37 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 email-tools/eximlogger/localdomains create mode 100755 email-tools/eximlogger/statsbyaddress.sh diff --git a/email-tools/eximlogger/localdomains b/email-tools/eximlogger/localdomains new file mode 100644 index 0000000..a072af5 --- /dev/null +++ b/email-tools/eximlogger/localdomains @@ -0,0 +1 @@ +benjamyn.love diff --git a/email-tools/eximlogger/statsbyaddress.sh b/email-tools/eximlogger/statsbyaddress.sh new file mode 100755 index 0000000..29df88e --- /dev/null +++ b/email-tools/eximlogger/statsbyaddress.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Hopefully I can get this to work, it should be able to helps with troubleshooting email issues + +MAILLOGFILE="/var/log/exim/main.log" +LOCALDOMAINFILE="localdomains" +EMAILADDR=$1 +SEARCHTERM=$EMAILADDR +LOCAL=false + +isDomainLocal() { +grep $1 $LOCALDOMAINFILE > /dev/null +if [[ $? == 0 ]] +then +TMPVAL=`echo $EMAILADDR | cut -d '@' -f 1` +SEARCHTERM=$TMPVAL +echo "$TMPVAL" +fi +} + +DOMAIN=`echo $EMAILADDR | cut -d '@' -f 2` +isDomainLocal $DOMAIN +echo "$SEARCHTERM" + +echo "---------Email Throughput for $1--------" +echo "Emails Sent by: `exigrep $SEARCHTERM $MAILLOGFILE | grep "<= $SEARCHTERM" | wc -l`" +echo "Emails Sent to: `exigrep $SEARCHTERM $MAILLOGFILE | grep "=> $SEARCHTERM" | wc -l`" +echo "Total emails with $1: `exigrep $SEARCHTERM $MAILLOGFILE | grep -i 'completed' | wc -l`" + +echo "" +echo "--------Email ID's for sent/received--------" +echo "Sent By ID's:" +echo "`exigrep $SEARCHTERM $MAILLOGFILE | grep "<= $SEARCHTERM" | awk '{print $3 " From " $6 ":" $7}' `" +echo "Sent To ID's:" +echo "`exigrep $SEARCHTERM $MAILLOGFILE | grep "=> $SEARCHTERM" | awk '{print $3" To " $8 ":" $9}' `" + +echo "" +echo "-------Emails Send from Hosts-------"