Cloudmin Wish - monitor mail queue

4 posts / 0 new
Last post
#1 Thu, 11/15/2018 - 14:34
dumorian Pro Licensee

Cloudmin Wish - monitor mail queue

Hi All,

I would find a monitor for the number of messages in mail queues really useful. If an email account is hacked, the queue grows quickly. Worse, the chance of landing on email blacklists increases. If I could set a monitor in Cloudmin which would inform me if a mail queue increased to X number of messages, I would know within minutes of when it happened.

Thanks for all you do!

Wed, 12/05/2018 - 14:21
srosoftware Pro Licensee

Just noting that I've been wanting the same thing. Would also be nice if the output of a script could be used to populate a variable in System Monitoring.

I run something like the following on mail hosts:

#!/bin/bash

EMAIL="mymail@example.com"
MAXV=29
declare -i QNUM
declare -i QNUM2

QNUM=`mailq | /usr/bin/tail -n1 | /usr/bin/gawk '{print $5}'`

if [ $QNUM -gt $MAXV ]; then

# wait a few seconds and check again
sleep 9
QNUM2=`mailq | /usr/bin/tail -n1 | /usr/bin/gawk '{print $5}'`

# if queue is still over maxv, mail warning
if [ $QNUM2 -gt $MAXV ]; then
    QSD=`qshape deferred`
    echo -e "Mail queue at `hostname` has $QNUM2 messages \n $QSD" | mail -s "ALERT: Mail queue" $EMAIL
fi
fi

SRO Software

Thu, 12/06/2018 - 08:09
scotwnw Pro Licensee

There is a mail que monitor in webmin, other, 'system and server status'. I've never used it but it looks like it would monitor the over all server que. Not per mail box but at least you would get notified and could search for the culprit from there. I'm sure you've tried it but thought I'd mention it just in case.

Thu, 12/06/2018 - 10:34
srosoftware Pro Licensee

Thanks! No idea why I didnt see that. I monitor dozens of services and sensors with the status module so theres no excuse :).

Nice it supports Sendmail, Postfix and Qmail too. I am going to test it against my current crons and see how well it works.

I have been planning to update scripts to check the state of the queue, not just the size so its not triggered by legit mailing lists, but a sufficiently high number combined with a throttled MTA catches a queue with tons of deferred messages.

SRO Software