Michael Durket: > In situations where there are tens of thousands of messages piling up in > the Postfix mail queue, running a 'postqueue -p' command and then > waiting until the last line prints isn't a very timely way to find out > the > current queue size (I'm thinking in terms of a periodic monitor like > Nagios for example). > > So what's the best way to quickly (i.e. less than a few seconds) get the > current queue count out of Postfix?
Fastest: have a dedicated file system and count the number of used versus free inodes (df -i). This produces an instantaneous result regardless of the queue size (*). Slower: a suitable perl script that exploits the fact that directories have one-character names. I'll leave that up to Victor. Slower: a suitable incantation of the find command. Slowest: mailq/postqueue -p, because that opens each file. Wietse (*) Except on systems where df(1) secretly invokes sync(2); SunOS was such an example.