>2009/9/30 Scott Miller <srmil...@interbel.net>: >> In case anyone is interested, I've attached a working Postfix Mail Queue >> Monitor for nagios - It's working for me as is, but if anyone has any >> suggested modifications I'd be glad to look at them. > >We do something like this where I work, a mailqueue-size check for >nagios via NRPE. There was some discussion a little while ago finding >the queue size; the long and the short is that invoking postqueue is >bad (it's painfully slow). > >If you're interested, dig up the thread in your favourite archives and >have a read, the subject is/was "Recommended way to (quickly) get >total mail queue size?", around 2009-07-08. > >I'm in the process of improving our own systems, which will move to >using Victor's suggested perl script. In some ad-hoc testing, I reckon >it's easily 1-2 orders of magnitude faster than postqueue when there's >a fair amount of mail queued up. > >P.S. Apologies if I'm wrong about the script using postqueue, but I >didn't read every single line, just had a skim to appease my >suspicions.
here's mine, very fast with "find": #!/bin/sh for Q in incoming active deferred hold ; do SIZE="`find /mail/spool/postfix/$Q -maxdepth 5 -type f | wc -l | tr -d ' ' `" dd if=/dev/zero bs=1 count=$SIZE of=/var/db/postfix/q_size_$Q done exit 0 then I have monit monitor the filesizes of those 4 files. Len