Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Is there an available perl script or any script for checking the mail queues of each instance of sendmail? So that we can use that on nagios nrpe, since the mailq command is only designed for one instance.

share|improve this question
Can you describe the setup you wish to monitor a little bit more? – adamo Jan 20 '12 at 11:55
i wish to monitor the mail queues of each sendmail instance – Sam Jan 21 '12 at 3:21
Unfortunately, your response to @adamo's comment is every bit as vague as your original question. Are you saying that you want Nagios to generate an alert when there is more than one instance running? We cannot help you if you cannot explain what you are trying to do. – Skyhawk Jan 21 '12 at 3:30
Since he mentioned nrpe I think that each instance is running on another computer. – Starfish Jan 21 '12 at 3:38

A sendmail "instance" in a host is a sendmail that is started with a configuration file. A sendmail instance is not a sendmail process. So if you see that the output of ps -auxw contains multiple sendmail processes, this does not mean that the host is running many sendmail instances.

The normal case these days is that there exist two sendmail instances running in your host One that is started and running the configuration described in /etc/mail/ and a second that is started with the configuration described in /etc/mail/ To see the mail queues that these two instances mailtain you execute the commands:

mailq -C /etc/mail/
mailq -C /etc/mail/

In the highly unlikely case that you have other instances running, corresponding .cf file must exist. You can view them queues then by running mailq -C for them too.

You can combine in a (Perl) script the output of such commands to do whatever you want afterwards.

share|improve this answer

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.