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


Remember Me

Directory Tree


8 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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):
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 @@

# 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:
byManubz, May 21, 2014

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: