Postfix:pmm

This is a shell script to review Postfix maillog. There are two required files, the first one is the shell script and the second file is the rules file which is colon delimited.

maillog="/var/log/maillog" rules="$HOME/rules" if [ -r $maillog ] then if [ -r $rules ] then totals { cat $rules | while read line do     set -- `echo $line` echo $line | awk -F: '{printf $1 ":"}' grepvar=`echo $line | cut -d ":" -f 2` grep "$grepvar" $maillog | wc -l done } totals | awk '{ print $NF, $0 }' | sort -rn | awk '{ $1 = ""; n = $NF; $NF = ""; printf("%40s %d\n", $0, n) }' | sed /": 0"/d else echo "I need a $rules file. Please try again." fi else echo "I don't have read access to $maillog, please try again." fi exit 0
 * 1) !/bin/sh
 * 2) pmm: postfix maillog metrics
 * 3) yashy@mail.yashy.com
 * 4) Thu Dec  8 20:37:08 EST 2005

Rules file: Unverified addresses: unverified address Undeliverable addresses: ndeliverable address qmgr: qmgr warning: warning Connect/Disconnect: connect from timeout after RSET: timeout after RSET Cleaned up: cleanup Too many errors: too many errors statistics: statistics: Time out: Operation timed out TLS connections: TLS connection TLS Server cert not verified: Server certificate could not be verified TLS cert failed: certificate verification failed for TLS peer name failed: certificate peer name verification failed for 450 Mailbox unavailable: 450 sorry, mailbox currently unavailable 450 Recipient address rejected: Recipient address rejected 550 Invalid Recipient: 550 Invalid recipient 550 User Unknown: User unknown (in reply to RCPT TO command) 550 Recipient rejected: 550 Recipient Rejected 553 Domain not in rcpthosts: 553 sorry, that domain isn't in my list of allowed rcpthosts