"Simon K. Grabowski" <[EMAIL PROTECTED]> writes:
> I have noticed that whenever a large mail server is down
> (i.e. mail.com or yahoo.com) queue gets much bigger.
> This is normal and understandable, but sometimes a huge
> queue lags message delivery to mail servers that are working okay.

Yup, been there, seen that.. too frequently, sadly.

> Is there a tool / script that'd print the biggest mail servers
> in queue. i.e. in a list...
> yahoo.com    5684 (messages in queue)
> mail.com    1243 etc.
> 
> I know that postfix has a tool that does that...
> 
> What about qmail?

I've not taken it as far as pulling out all the domains, but I have a
few scripts that I use on a regular basis as follows. These are not
models of efficiency, but they do the job:

qusers:
  #!/bin/sh
  # show number of messages queued up per address
  /var/qmail/bin/qmail-qread | grep remote | grep -v done | sort | uniq -c | sort -n 

qyahoo:
  #!/bin/sh
  # summarise number of messages queued for a domain
  qusers | awk '$3 ~ /@yahoo\./ { sum=sum+$1 } END { print sum }'

Just for you, here's a freshly written script that counts things by
domain part. It doesn't attempt to establish what mail server they're
queued for (qmail doesn't store that information handily, one would
have to go through the log files and try and deduce it from the
information):

qdomains:
  #!/bin/sh
  /var/qmail/bin/qmail-qread | nawk '$1 ~ /remote/ { sub(/^.*@/,"",$2); 
domains[$2]=domains[$2]+1 } END { for ( domain in domains ) { print domains[domain], 
domain; } }' | sort -n

hope that helps,

James.

Reply via email to