Best way to measure sendmail queue depth?

campbell at campbell at
Sat Jun 17 00:01:33 IST 2006

Quoting "Furnish, Trever G" <TGFurnish at>:

> I've been checking sendmail inbound queue depth using a simple readdir
> and dividing the number of entries by two.  This is checked every five
> minutes by Nagios with a 10-second timeout -- because of the timeout and
> the frequency with which I want to do the check, I can't just use, for
> example:
>     mailq |head -1
> ...because under heavy flow conditions the mailq command takes WAY too
> long to parse the entire set of queue files and generates too much load.
> I always realized dividing the number of files in the queue by two was
> only a rough guess, but I didn't realize there could be so much
> disparity between that number and the number of messages listed by
> mailq.  With mailq reporting 6 messages in the inbound queue, the
> directory actually contains 477 files!

The multitude of non-paired files are probably DATA files (df) of some
incomplete connections. You can probably delete all of these, but I would check
the times on them first. This is more than likely an attempt to clog up your MTA.

You could use a script with 'find' telling you which ones are older than a
certain time period (one day should be very safe, one hour is probably OK), and
delete them. Just a simple one-liner in your cron. Other than that, I'm sure
there are sendmail options that would take care of this too, but they don't jump
to mind right now, probably 'timeout_' options are the easiest to do.
> Mailq's result seems to match the count of files starting with a
> lowercase "q".  I also have about the same number of files starting with
> an uppercase "Q".  The rest of the files are df files, most of them
> without any corresponding q file.

The 'Qf' files, I believe, are non-deliverable files, those that can't be
delivered even to postmaster. They are renamed qf files.

Hope this is accurate.

Steve Campbell

> Any idea what's going on?  Previously I expected to find files that
> started with qf, df, xf, and tf (not Q), and to always have pairs of
> files.  Obviously my expectation was pretty far off. :-)
> --
> Trever
> -- 
> MailScanner mailing list
> mailscanner at
> Before posting, read
> Support MailScanner development - buy the book off the website! 

This mail sent through IMP:

More information about the MailScanner mailing list