Postfix

check_postfix_mailqueue

Description:

Checks postfix mailqueue statistic

Current Version

1.0

Last Release Date

2012-01-21

Compatible With

  • Nagios 3.x

Owner

License

GPL


Project Files
Project Notes
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) Add a Review
Nice plugin
by altmas5, March 31, 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



race condition patch
by rstevens, March 31, 2018

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` }



Select Queue
by mlwood98, September 30, 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



How fix permissions
by Manubz, May 31, 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.



Run plugin from nrpe
by caramia, March 31, 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



Works well, needs a bit of work though
by alexlehm, December 31, 2013

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



Project Stats
Rating
4 (8)
Favorites
1
Views
93,805