Hello all,
I'm back to you for a question about Monit.
I want to monit the mailq size and for that, I wrote a script and a monit plugins.
The script is here (postfix_queue.sh):
#!/bin/bash
postfix_queue=`postqueue -p | grep Requests | awk {'print $5'}`
if [ "$postfix_queue" \< "100" ]
then
exit 0
elif [ "$postfix_queue" \>= "100" and \<= "200"]
exit 1
else
exit 2
fi
And the monit plugin is:
check program postfix_queue with path /root/postfix_queue.sh every "0 1 * * *"
group mail
if status == 1 then alert
if status == 2 then exec "/usr/sbin/postsuper -d"
The goal is to monitoring the mailq size.
If the number of sending mail in mailq is less than 100, nothing to do.