Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to check the number of mails in active queue on various Postfix installations, as a Nagios alert.

My first idea is to write a small Nagios plugin that SSHs to the Postfix server and read the value that I obtain through another little script. Then, Nagios will check this value against its warning and critical levels, as set up.

Is this approach what you'd call correct? Or doing through SSH is "too much"? Should I use the 5666/tcp Nagios port instead? (if yes, I did not find any example about yet)

share|improve this question
Instead of using ssh, I'd recommend using the nrpe daemon. On the mail server nrpe can use the same script as you would call via ssh. – mauro.stettler Aug 19 '13 at 11:32
Go to nagios exchange and postfix section at There are plenty of queue monitoring scripts so feel free to choose one and customize it as you wish. – dsmsk80 Aug 19 '13 at 11:46
Thank you all, done with my own little script via NRPE. – fsoppelsa Aug 19 '13 at 13:13
up vote 3 down vote accepted

Don't reinvent the wheel.

There are several "queue" checks posted on Nagios Exchange. For example: check_postfix_queue.

To use any of these as actove checks, you will need an agent of some sort. You can use NRPE, check_by_ssh, check_mk, etc., or you could even plumb it into snmpd if you were motivated (don't do that).

NRPE has a lower overhead than using ssh sessions, but the security of check_by_ssh is arguably a bit better, because you use SSH keys instead of just restricting it by IP. Whether or not this is important depends on your particular setup; if you have a private/out-of-band monitoring network, NRPE is fine. If you're checking over the Internets, check_by_ssh might be better.

share|improve this answer
There's a wrapper named MRPE supported by check_mk_agent. – Florian Heigl Nov 19 '13 at 21:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.