OT: MailScanner & Nagios

Dave Jones davejones70 at gmail.com
Mon Mar 2 14:22:39 GMT 2009

>Date: Mon, 2 Mar 2009 12:39:59 +0100
>From: "Jonas Akrouh Larsen" <jonas at vrt.dk>
>Subject: RE: OT: MailScanner & Nagios
>To: "'MailScanner discussion'" <mailscanner at lists.mailscanner.info>
>Message-ID: <006601c99b2b$9e56afb0$db040f10$@dk>
>Content-Type: text/plain;       charset="us-ascii"
>The only mailscanner variables we monitor is the presence of the mailscanner
>process and ascoiated processes. And the avg. batch scan speeds.
>-----Original Message-----
>From: mailscanner-bounces at lists.mailscanner.info
>[mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf Of Jethro R
>Sent: 27. februar 2009 21:25
>To: MailScanner discussion
>Subject: Re: OT: MailScanner & Nagios
>On Fri, 27 Feb 2009, Eduardo Casarero wrote:
>> Hi everybody, is anyone using nagios to monitor MailScanner? i was
>> looking for some plugins to check mailscanner status, queues, etc. The
>> basic server monitoring is already set up, but if someone has already
>> coded some custom plugins for mailscanner and wants to share i would be
>> very happy :D
>> if not, i'll have to do it my self.
>What exactly do you want to monitor?  There are already plugins to check
>status of processes, and MailScanner itself doesn't have queues: the
>queues are for the MTA, and there are plugins to check them too.  What
>MailScanner-specific items do you want to monitor that are not covered by
>the present Nagios plugins?

One directory that we monitor is the /var/spool/mqueue.in for the MailScanner
inbound queue.  The default Nagios plugin check_mailq will only get the
default sendmail outbound queue in /var/spool/mqueue.  The code below is
a little crude but it works...
 MQ_IN_COUNT=`sudo /bin/ls -l $MQ_DIR/ | wc -l | awk '{print $1}'`

Another useful Nagios script to run using NRPE is inbound and outbound
queues by domains.  If you have an important domain that you host which
has common connectivity problems, then it's good to know when outbound
mail to that domain is backing up.

MQ_COUNT=`sudo mailq -qR$DOMAIN | grep -i "Total requests:" | awk '{print $3}'`

Just wrap your normal beginning (check args) and ending (exit codes)
Nagios plugin stuff around the above two snippets to make two scripts.
You will need to have your "nagios" ID setup in sudo to make them work.
And don't forget to disable the "requiretty" line in sudoers.



More information about the MailScanner mailing list