Postfix

check_postfix_queue

Description:

This will display the current queue of Postfix.

Current Version

1.1

Last Release Date

2010-07-19

Compatible With

  • Nagios 3.x

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!
Project Files
Project Notes
Client configuration ==================== 1) Put the script in the appropiate directory on the client. If you compile from source, it should be /usr/local/nagios/libexec. 2) Add the following to nrpe.cfg. command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 20 -c 40 3) Restart nrpe. Server configuration ==================== 1) Edit an existing nrpe service and change the check_command to check_nrpe!check_queue 2) Check if the configuration is correct. /usr/bin/nagios -v /etc/nagios/nagios.cfg 3) Restart Nagios. /etc/init.d/nagios restart Changelog 12-08-2010 ========== - Added patch to display perfdata (thanks box2) - Edits to honour Bash coding style - Removed unnecessary pipe to wc(8)
Reviews (9) Add a Review
Needed some permission fixes
by christoph.mueller, March 31, 2018
I think the postfix installer on debian set spermissions after each upgrade. (postfix set-permissions). So changing permission does not have a permanent effect.

If you want to use this plugin after all without changing the owner of /var/spool/postfix subdirectories - then here is what I've done:

# add user nagios to postfix group
usermod -a -G postfix nagios

# add user nagios to postdrop group
usermod -a -G postdrop nagios

# add user nagios to root group (very insecure)
usermod -a -G root nagios

# allow directory listing for all postfix directories
find /var/spool/postfix -type d -exec chmod g+x {} +
Helpful? Yes  No 
works good, but needs long QID support
by Simerson, December 31, 2015
Great plugin, it works well. Thanks.

Please update to use this regex instead, as it supports both short and long postfix QIDs:

queue_id='^(?:[0-9A-F]{10,11}|[0-9A-Za-z]{14,16})!s'
Helpful? Yes  No 
Excellent
by elbui, April 30, 2014
I've just installed your nagios plugin 'check_postfix_queue' , but I don't know the log file that it checks.
I have Plesk installed in my server and the maillog path is not the default /var/log/maillog but is /usr/local/psa/var/log.
If your Plugin checks the dafault path, is there a possibility to change it ?
I would really appreciate your help.
Helpful? Yes  No 
just a little patch for a less cryptic error when running without the right arguments
by natxo, February 28, 2014
diff check_mailq /tmp/test
16,17c16
and line usage"
Helpful? Yes  No 
very good!!
by frayber, October 31, 2012
Thank you for sharing!
Which is the best way of setting script permissions without (or minimizing) security issues?
Helpful? Yes  No 
Always shows 0 for queues due to permissions
by ThatGraemeGuy, March 31, 2012
This doesn't actually work, although you may not realise it because it *seems* to work just fine.

Postfix queue directories are only readable by root and the postfix user. NRPE commands are executed by the nagios user, which cannot see inside postfix's queue directories.


Normal user, shows 0 in all queues:
$ /usr/lib/nagios/plugins/check_postfix_queue
OK: incoming queue messages: 0 active queue messages: 0 maildrop queue messages: 0 deferred queue messages: 0 bounce queue messages: 0

Nagios user, shows 0 in all queues:
$ sudo -u nagios /usr/lib/nagios/plugins/check_postfix_queue
OK: incoming queue messages: 0 active queue messages: 0 maildrop queue messages: 0 deferred queue messages: 0 bounce queue messages: 0

As root, reports correct numbers:
$ sudo /usr/lib/nagios/plugins/check_postfix_queue
OK: incoming queue messages: 0 active queue messages: 1358 maildrop queue messages: 0 deferred queue messages: 2922 bounce queue messages: 0
Owner's Reply:

Funny, I may seem to imagine the last warnings Nagios complained about when the queue reached my thresholds. Futhermore,just fix your permissions (e.g. groups and adding the nagios user to the correct group.) If you use Nagios to monitor queues, you'd better be able to fix these "problems". If not, don't you even think about using Nagios. Makes me wonder how you fixed it with the other plugins available.


Helpful? Yes  No 
Good work
by matthudson, April 30, 2011
Does what it says on the tin!
Helpful? Yes  No 
Works great
by coffeeguy, September 30, 2010
check_postfix_queue works great. Thanks!
Helpful? Yes  No 
Very nice
by box2, August 31, 2010
Simple, very portable, awesome. Thanks for posting this. I wanted to make some pretty RRD graphs too so I added a perfdata section. The patch is here:

http://www.mediafire.com/?r965aj299gd09cm
1 of 1 found this review helpful.
Helpful? Yes 1 No 0
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.5 (12)
Favorites
0
Views
144,642