Zimbra - Monitoring Queue Mail
Monitoring Queue Mail Zimbra dengan menggunakan postqueue di bash script. auto monitor queue mail zimbra. ketika queue (antrian email melebihi 75 email) maka otomatis akan memberitahukan ke user@email . Jika sudah turun dibawah 75 akan diberikan status OK.
#!/bin/bash
#count=76
count=$(/opt/zimbra/postfix/sbin/postqueue -p | awk '{ print $1 }' | grep "@" | wc -l)
if [ "$count" -ge "75" ];then
#true
grep "lock" /tmp/queue.lock
#if false
if [ "$?" -eq "1" ];then
#send notice here down
# echo "gt 10"
until [ "$count" -lt "75" ];
do
#sleep 60
count=$(/opt/zimbra/postfix/sbin/postqueue -p | awk '{ print $1 }' | grep "@" | wc -l)
if [ "$count" -ge "75" ];then
echo "send notice here down"
# echo "gt 10"
fi
echo "lock" > /tmp/queue.lock
sleep 60
done
echo "send notice here up"
## echo "lt 10"
echo "" > /tmp/queue.lock
fi
fi
lalu simpan di dalam crontab:
#monitor mail queue
*/10 * * * * /bin/bash /opt/zimbra/backup/scripts/monitorqueue/run.sh