a couple Q'n'D scripts for tuning

Len Conrad LConrad at Go2France.com
Sun Feb 8 21:52:17 CET 2015


#!/bin/sh

touch /var/tmp/load-data.txt

D=`date "+%Y-%m-%d %H:%M"`

ACTIVE=`find /var/spool/postfix/active/ -type f | wc -l|tr -d " "` 

echo "$D `uptime | awk '{print $(NF-2),$(NF-1),$NF}'|\ 
 tr -d ','` $ACTIVE" |\
 awk '{printf "%-10s%6s%5s%5s%5s%4s\n",$1,$2,$3,$4,$5,$6}' \
 >> /var/tmp/load-data.txt

exit 0


cron'd at */1 minute, out file contains:

date; time;  1min ;5min; 10min; msgs; in postfix active queue (sum of msgs active to amavisd socket and next smtp hop)

2015-02-08 13:58 1.38 1.51 1.54   1
2015-02-08 13:59 1.64 1.58 1.56   2
2015-02-08 14:00 1.42 1.53 1.54   4
2015-02-08 14:01 2.32 1.77 1.63   0
2015-02-08 14:02 1.73 1.72 1.62   2
2015-02-08 14:03 1.77 1.70 1.62   0
2015-02-08 14:04 1.03 1.50 1.55   2
2015-02-08 14:05 1.27 1.46 1.52   2
2015-02-08 14:06 2.38 1.72 1.61   6
2015-02-08 14:07 2.48 1.89 1.68  10
2015-02-08 14:08 2.10 1.86 1.68   6
2015-02-08 14:09 1.75 1.80 1.67   7
2015-02-08 14:10 1.86 1.83 1.68   7
2015-02-08 14:11 1.22 1.67 1.63   2
2015-02-08 14:12 1.13 1.58 1.60   3
2015-02-08 14:13 1.05 1.49 1.57   2
2015-02-08 14:14 0.86 1.34 1.50   0
2015-02-08 14:15 0.90 1.25 1.46   0
2015-02-08 14:16 1.36 1.31 1.46   3
2015-02-08 14:17 2.05 1.50 1.52   5
2015-02-08 14:18 1.71 1.51 1.52   6
2015-02-08 14:19 2.35 1.71 1.59   5
2015-02-08 14:20 2.25 1.79 1.62   6

===================

postfix field averaging, example below is for average "delay=xxx" field, is easily adapted for "qmgr.*from=" lines, for the "size=xxx" and "nrcpt=xxx" fields.

/usr/local/bin/field_average.sh

#!/bin/sh

egrep -i "postfix.*relay=127.0.0.1\[127.0.0.1\]:10024" /path/to/maillog |\
 awk '{for(i=1;i<=NF;i++){ if($i ~ /delay=/){print $i} } }' |\
 tr -d "delay=," |\
 awk '{sum+=$1} END {if (NR > 0) print "average =",sum/NR ; else print "no data to average"}'

exit 0



output:

/usr/local/bin/field_average.sh
average = 12.8976  (seconds)

... which is, imo, TOO LONG for avg delay for postfix delivering to amavisd socket.  reading up on amavisd tuning...  :)

to get the average for hour 12, add to the front of the egrep string:

"^... .. 12:.*postfix..."

question:

amavisd-nanny runs, no error, but no per-process activity bars.

Len







More information about the amavis-users mailing list