Best way to measure sendmail queue depth?

Furnish, Trever G TGFurnish at
Fri Jun 16 23:20:51 IST 2006

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
    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!
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.
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. :-)

More information about the MailScanner mailing list