Sunday, August 21, 2011

Lazy Postfix queue management

Postfix do come with some nice utilities to manage it's queues. In this case we are using qshape, postqueue and postsuper.

qshape allows us to check the 'shape' of the queues. The available queues are:

  • incoming - messages pending to be processed
  • hold - queue available to deposit messages that will remain on standby
  • active - messages being processed at that moment
  • deferred - messages that can't be delivered at that moment
  • maildrop - messages delivered locally
for checking the incoming, hold and active queues we will execute qshape -s incoming hold active (-s for displaying the sender domain's statistics)


                          T 5 10 20 40 80 160 320 640 1280 1280+
TOTAL             6  2  2    0    0    0     0     0     0      0     2
asiarooms.com  1  1  0    0    0    0     0     0     0      0     0
jahoo.com          3  1  2    0    0    0     0     0     0      0     0
pepeluis.es        2  0  0    0    0    0     0     0     0      0     2

The statistic shows us that we have a total of 6 emails, one email from asiarooms arrived in less than 5 minutes, 3 from jahoo.com that arrived between 1 and 10 minutes, and two from pepeluis.es with an age of more than 1280 minutes. 

A more detailed examination can be performed with the tool postqueue:

#postqueue -p

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
2FEE01260AA*   28213 Fri Aug 19 03:00:12  pepe.lopez@asiarooms.com  pepe.lopez@asiarooms.com

D516B1260A4*    5799 Fri Aug 19 03:00:22  faemalia@jahoo.com  info@asiarooms.com

028691260B8*    5803 Fri Aug 19 03:00:23  faemalia@jahoo.com  info@asiarooms.com


-- 19 Kbytes in 3 Requests.

The Queue ID will tell us the ID of each message. If we would like to get rid of any email, we can use the tool postsuper :

#postsuper -d 2FEE01260AA

That command will delete the first email showed from the postqueue. If we would like to delete all the current messages in a particular queue (i.e., deferred queque):

#postsuper -d ALL deferred

Or just all our emails to be delivered:

#postsuper -d ALL

This is a very basic overview of these commands, a lot more functions are shown on each command's man page, or in the official postfix documentation http://www.postfix.org/documentation.html





No comments:

Post a Comment