#!/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