[Mailman-Users] Re: mm_stats question

Jon Carnes jonc at nc.rr.com
Fri Feb 27 19:08:20 CET 2004


I just double checked and it works fine on all my sites...
Do you have any lists with "=" in the name?

If that is the case, then you would need to modify the first line and
add in an additional cut:

  SIZ=`grep -i "post to $i" $POST |grep success |cut -f2- -d, | \
     cut -f2 -d= |cut -f1 -d,`
  k=0; for j in $SIZ; do k=$(( j + k )); done
  echo "  Total bytes" = $k >> $TMPFILE

This additional cut will remove the listname from the line before using
the "=" to isolate the size of the message

If that doesn't do it for you, then drop a copy of your post log and the
name of the list with the problems and I'll see what needs to be
modified.

Hope this is helpful - Jon Carnes

On Fri, 2004-02-27 at 10:24, Al Black wrote:
> Hi Jon,
> 
> I trying out the mm_stats script you wrote (see 
> http://www.mail-archive.com/mailman-users@python.org/msg15378.html) and 
> have a couple of little bugs you might be able to help me with.  I'm using 
> version 2.1.4 of mailman.
> 
> I get two errors running the script from command line.
> 
> The first is:
> 
> ===: not found
> 
> I'm pretty sure this happens when the script hits a list we have that has 
> no traffic.
> 
> The second one is the one I'm more concerned with:
> 
> /usr/home/lamps/test/mm_stats: arith: syntax error: " j + k "
> 
> What seems to be happening is that the lines:
> #  SIZ=`grep -i "post to $i" $POST |grep success |cut -f2 -d= |cut -f1 -d,`
> #  k=0; for j in $SIZ; do k=$(( j + k )); done
> 
> isn't cutting the size=field properly.
> 
> Any suggestions for a fix?  Otherwise the script is running great, and it 
> will make my list members happy.  (In fact maybe it, or a bunch of 
> variations on it, could be included in the mailman 3 suite.)
> 
> Thanks in advance,
> al
> 
> 
> # Mailman's log file to be examined for stats
> POST=/usr/home/lamps/usr/local/mailman/logs/post
> 
> 
> # create temp file to collect stats
> TMPFILE=`mktemp /tmp/mm_stats.XXXXXX` || exit 1
> 
> 
> LIST="`/usr/home/lamps/usr/local/mailman/bin/list_lists |awk '{print $1}' 
> |sed -n '2,$p'`"
> for i in $LIST
> do
>    echo "Stats from local Mailman list: $i" > $TMPFILE
>    echo " "  >> $TMPFILE
>    echo -n "   Starting:  " >> $TMPFILE
>    head -1 $POST |cut -f1-3 "-d " >> $TMPFILE
>    echo -n "   Ending:    " >> $TMPFILE
>    tail -1 $POST |cut -f1-3 "-d " >> $TMPFILE
>    echo " ======================================= " >> $TMPFILE
>    echo -n "Total posts to the list: " >> $TMPFILE
>    grep -i "post to $i " $POST |wc -l >> $TMPFILE
>    echo -n "Total SUCCESSFUL posts to the list: " >> $TMPFILE
>    grep -i "post to $i " $POST |grep success |wc -l >> $TMPFILE
> #  SIZ=`grep -i "post to $i" $POST |grep success |cut -f2 -d= |cut -f1 -d,`
> #  k=0; for j in $SIZ; do k=$(( j + k )); done
>    echo "  Total bytes" = $k >> $TMPFILE
>    echo " "  >> $TMPFILE
>    echo "Top 10 posters to the list:" >> $TMPFILE
>    grep -i "post to $i " $POST |cut -f 10 "-d " |sort |uniq -c \
>       |sort -bgr |head -10 >> $TMPFILE
>    echo " " >> $TMPFILE
>    # Mail the collected stats off to the list admin and cc the mailman user
>    # mail -s "Mailman Stats for List: $i" -c mailman $i-admin <$TMPFILE
>    # mail the collected Stats for lists to the server admin
>     mail -s "Mailman Stats for List: $i" server-admin <$TMPFILE
> done
> 





More information about the Mailman-Users mailing list