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)

  • 3
    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. – replay Aug 19 '13 at 11:32
  • 1
    Go to nagios exchange and postfix section at tinyurl.com/mzyj9le. 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

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.

  • There's a wrapper named MRPE supported by check_mk_agent. – Florian Heigl Nov 19 '13 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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