Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_postfix_queue
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)
====================
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)
bychristoph.mueller, March 30, 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 {} +
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 {} +
bySimerson, December 3, 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'
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'
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.
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.
bynatxo, February 23, 2014
diff check_mailq /tmp/test
16,17c16
and line usage"
16,17c16
and line usage"
byfrayber, October 24, 2012
Thank you for sharing!
Which is the best way of setting script permissions without (or minimizing) security issues?
Which is the best way of setting script permissions without (or minimizing) security issues?
byThatGraemeGuy, March 26, 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
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.
bymatthudson, April 20, 2011
Does what it says on the tin!
bycoffeeguy, September 29, 2010
check_postfix_queue works great. Thanks!