[Mailman-Users] Mailman stat's

Jon Carnes jonc at nc.rr.com
Thu Feb 6 03:08:37 CET 2003


On Wed, 2003-02-05 at 14:02, Con Wieland wrote:
> Hello all
> 
> Before re-inventing the wheel has anyone created any general reporting 
> scripts. I need something like #of lists #number of subscribers, per 
> list, #number of posts per list, that kind of stuff. I'm sure they'll 
> come up with more once I get this far.
> 
> Thanks in advance
> Con Wieland
> UC Irvine
> 

Here is a stat's script that we use.  It sends out monthly status
reports to the Mailman admins as well as to each lists admin.

#For the number of lists:
 ~mailman/bin/list_lists -b |wc -l

#For the number of users in each list:
  for i in `~mailman/bin/list_lists -b`;
  do
    j=`~mailman/bin/list_members $i |wc -l`
    echo "list $i has $j members"
  done


=== mm_stats script ===
#! /bin/bash
# Run monthly stats on Meeting maker logs
#  - top 10 users of each list
#  - Number of attempted posts (per list)
#  - Total bytes sent (per list)
#
# Mailman's log file to be examined for stats
# We rotate the logs monthly and run this script
# around 6am on the first of each month.
# The newly rotated monthly file is post.1
POST=~mailman/logs/post.1

# create temp file to collect stats
TMPFILE=`mktemp /tmp/mm_stats.XXXXXX` || exit 1

LIST="`/home/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 collected stats off to the list admin and cc the mailman user
  mail -s "Mailman Stats for List: $i" -c mailman $i-admin <$TMPFILE
done

# remove the temp file
rm $TMPFILE
=== end of mm_stats script ===

Hope these help - Jon Carnes




More information about the Mailman-Users mailing list