Created
August 6, 2019 15:46
-
-
Save kosztik/6aaf947ac2fdfe6d56b2894b4f6ee4d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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