Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_postfix_mailqueue

Rating
8 votes
Favoured:
1
Current Version
1.0
Last Release Date
2012-01-21
Compatible With
  • Nagios 3.x
Owner
License
GPL
Hits
93801
Files:
FileDescription
check_postfix_mailqueueCheck
check_postfix_mailqueue.phpPNP-Template
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Checks postfix mailqueue statistic
check_postfix_mailqueue is a Nagios plugin which generates statistics for the postfix mailqueue (perfdata) and checks for corrupt messages.
The following values will be checked:
maildrop: Localy posted mail
incoming: Processed local mail and received from network
active: Mails being delivered (should be small)
deferred: Stuck mails (that will be retried later)
corrupt: Messages found to not be in correct format (shold be 0)
hold: Recent addition, messages put on hold indefinitly - delete of free

You can set warn and crit levels for deferred mails.
When critical and warning levels are not set, the plugin returns OK, as long as there are no corrupt messages.
PNP-Template is also available.
Reviews (6)
byaltmas5, March 26, 2018
I am starting to use this plugin and I find it extremely useful.
I checked alexlehm's version and I think it's necessary to set a threshold to warn on bounce message count and not warn since first bounced message.
I added a argument (-b):

https://gist.github.com/altmas5/1006fc44c035b6b403099bfeca5f60fb
If an email is delivered between 'find' seeing it and stating it, you get messy output. find has the '-ignore_readdir_race' switch to address this.

@@ -132,10 +132,10 @@
done

# Get values
-deferred=`(test -d deferred && find deferred -type f ) | wc -l`
-active=`(test -d active && find active -type f ) | wc -l`
-corrupt=`(test -d corrupt && find corrupt -type f ) | wc -l`
-hold=`( test -d hold && find hold -type f ) | wc -l`
+deferred=`(test -d deferred && find deferred -ignore_readdir_race -type f ) | wc -l`
+active=`(test -d active && find active -ignore_readdir_race -type f ) | wc -l`
+corrupt=`(test -d corrupt && find corrupt -ignore_readdir_race -type f ) | wc -l`
+hold=`( test -d hold && find hold -ignore_readdir_race -type f ) | wc -l`
bounced=`cat /var/log/maillog | grep bounced | wc -l`
}
bymlwood98, September 16, 2014
I have made an update to alexlehm's version of this script to include a -q parameter with which to select which queue on which to alert.

This change arises from an issue we have seen at my company where the postfix server gets flooded with several thousand messages at once. Postfix continues to process them, so they do not get moved to the deferred queue, but the active and incoming queues grow to almost 2GB apiece.

The new version can be downloaded here: https://gist.github.com/mlwood98/c5cb1e80be595b625c60
byManubz, May 21, 2014
Hi,

I think plugin is so good !
But i have problems with permissions (I think).
ls -l /var/spool/postfix returns postfix:root for all folders.
But if I give read permission to root group, script always returns OK and 0 for all. I run script as root user.

Thanks for your return.
bycaramia, March 27, 2014
To run the plugin from nrpe it is necessary execute it with the sudo permission or the plugin respond always OK with all zero value
byalexlehm, December 22, 2013
1 of 1 people found this review helpful
Works well, this script checks the mailqueue by directly counting the files in the queue directories, which has the advantage that is will probably be much faster for queues contains 1000s of mails.

Two minor things (not sure if this is right place to report bugs), the command parsing calls the script itself which doesn't make any sense if a parameter is ignored and the check reports 0 for all queues if the directories are not readable due to incorrect permissions or user, in this case /var/spool/postfix is usually readable, but the queue subdirs are not.

A revised script is available here: https://gist.github.com/alexlehm/8084195