Skip to content

Instantly share code, notes, and snippets.

@kosztik
Created August 6, 2019 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosztik/6aaf947ac2fdfe6d56b2894b4f6ee4d3 to your computer and use it in GitHub Desktop.
Save kosztik/6aaf947ac2fdfe6d56b2894b4f6ee4d3 to your computer and use it in GitHub Desktop.
#!/bin/bash
softMail=400
#^^^^^nincs használatban
maxMail=500
#^^^^^^^^^^ Ezt hasznalom jelenleg
rm /tmp/spamMailSentLine.txt
today=`date|cut -d' ' -f2-4`
grep -e "^$today " /var/log/mail.log | grep "sasl_method"|cut -d',' -f3| sort |uniq -c| sort -n > /tmp/todayMailSent.txt
function check {
isThereProblem=0
cat /tmp/todayMailSent.txt | while read LINE
do
sentEmail=`echo $LINE|cut -d ' ' -f1`
if [ "$sentEmail" -gt "$maxMail" ];then
echo "$LINE" > /tmp/spamMailSentLine.txt
fi
done
if [ -e /tmp/spamMailSentLine.txt ];then
desc=`cat /tmp/spamMailSentLine.txt`
echo "epsilon check_sentMails 2 CRITICAL $desc" | send_nsca -H nag.geotagmail.com -p 5667 -c /etc/send_nsca.cfg
else
echo "epsilon check_sentMails 0 OK" | send_nsca -H nag.geotagmail.com -p 5667 -c /etc/send_nsca.cfg
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment