monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Monit and mailq size


From: Fabien Morcamp
Subject: Monit and mailq size
Date: Fri, 23 Jan 2015 11:41:11 +0100

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.
If between 100 and 200, send an alert.
And if bigger than 200, clear the mailq.

I think this is going to works but I would like to know if it can possible to do the same thing whithout call an external script ?

If not, do you see a better process to do that ?

Somebody already have to do that ?

Thanks a lot for your helps and ideas.

Fabien

reply via email to

[Prev in Thread] Current Thread [Next in Thread]