Monitor Postfix Mail Queue

Marc Powell marc at ena.com
Mon Sep 28 23:10:39 CEST 2009


On Sep 28, 2009, at 4:46 PM, Scott Miller wrote:

> I'm trying to get Nagios to monitor a local Postfix Mail Queue, with  
> no
> luck.  The service keeps reporting OK: Postfix mailq has 0 messages  
> queued,
> when I know for a fact there are messages in the queue.  I'm wanting  
> to use
> Nagios on this local machine to monitor the queue, and alarm/notify  
> when it
> reaches a certain threshold.  I have modified the check_mailq to the
> following: (retrieved from
> http://wiki.osuosl.org/display/LNX/Nagios+Postfix+Mailq+Plugin )


> # let's get to it
> # my $result = `/usr/sbin/postqueue -p`;
>
> # Do it more lightweight
> my $result = `ls -1 /var/spool/postfix/deferred/*/* 2>/dev/null | wc  
> -l`;

Strange that they wouldn't use postqueue...

>
> I did modify one line above - because it was reporting 0 messages in  
> queue.
> I changed:
>
> my $result = `ls -1 /var/spool/postfix/deferred/?/* 2>/dev/null | wc  
> -l`;
> to read:
> my $result = `ls -1 /var/spool/postfix/deferred/*/* 2>/dev/null | wc  
> -l`;
>
> Still - it reports (OK: Postfix mailq has 0 messages queued), when  
> at this
> time there are 9 messages in queue.
>
> Anyone have any luck implementing this with postfix?  If so, can  
> anyone see
> what I'm doing wrong?

While I can't give the postfix specific answer to this, I can pretty  
much guarantee it's because the user you are running the plugin as  
does not have access to /var/spool/postfix or anything beneath it. I  
do not know how finicky postfix is with permissions but you may be  
able to add the nagios user to the group that those files/directories  
are members of, verify read permissions exist for the group and try  
again.

IMHO, the better way is to use postqueue, either preferably with sudo  
or with sticky bit.

--
Marc


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list