Steve Campbell wrote:

Karl,

The reason that only '=>' lines are counted as each one of these represent a message sent down a transport and significant work done. Each '->' line is an additional address at the same destination which does not require a new message to be sent and is not a significant amount of work.

Hence treating '=>' and '->' lines the same would not be accurate!

However, we could do a seperate count of addresses (recipients) in addition to the message and volume counts and show these.

I'll put it on to the todo list.

Steve


Thanks Steve,

I thought nobody is interested in this topic, so I worked on this
myself. I tried not to mess up the total statistics, so I'm counting
the '->' only for local_users and remote_users ($size) ...
The totals are counted with the (new) $tsize, which is only set if
$flag is '=>' (counting as it was ...)

Of course the new behavior is switched on with a new commandline
switch -cd to count the duplicates ...

So here's the diff with my changes to V1.36 ...
On request I can post/send the complete file (be aware, it's 96k)

comments welcome ... (pls let me know if that's usable ...)

- Karl




*** /usr/sbin/eximstats Fri May 27 10:10:10 2005
--- /usr/local/sbin/eximstats   Mon Feb  6 23:42:46 2006
***************
*** 196,201 ****
--- 196,206 ----
  #
  # 2005-02-07  V1.36 Gregor Herrmann / Steve Campbell
  #             Added average sizes to HTML Top tables.
+ #
+ # 2006-02-06  V1.36a Karl Fischer
+ #             Added a new cmd-line switch -cd to count duplicate deliveries
+ #             => and -> for each account seperately for the
+ #             Top <n> (local|host) destinations by (volume|message count)


  =head1 NAME
*************** Don't display transport information.
*** 239,244 ****
--- 244,253 ----

  Don't display transport information that matches

+ =item B<-cd>
+
+ Count duplicate deliveries seperately for each host
+
  =item B<-q>I<list>

  List of times for queuing information single 0 item suppresses.
*************** On B<Debian GNU/Linux> you can use
*** 354,364 ****
  C<apt-get install libgd-perl libgd-text-perl libgd-graph-perl>
  instead.

! =item B<-chartdir>I <dir>

  Create the charts in the directory <dir>

! =item B<-chartrel>I <dir>

  Specify the relative directory for the "img src=" tags from where to include
  the charts
--- 363,373 ----
  C<apt-get install libgd-perl libgd-text-perl libgd-graph-perl>
  instead.

! =item B<-chartdir> I<dir>

  Create the charts in the directory <dir>

! =item B<-chartrel> I<dir>

  Specify the relative directory for the "img src=" tags from where to include
  the charts
*************** use vars qw($topcount $local_league_tabl
*** 453,458 ****
--- 462,469 ----
  use vars qw($hist_opt $hist_interval $hist_number $volume_rounding);
  use vars qw($relay_pattern @queue_times $html @user_patterns 
@user_descriptions);

+ use vars qw($count_duplicate);
+
  use vars qw(%do_sender);                #Do sender by Host, Domain, Email, 
and/or Edomain tables.
  use vars qw($charts $chartrel $chartdir $charts_option_specified);
  use vars qw($merge_reports);                  #Merge old reports ?
*************** of the messages processed. Valid options
*** 1341,1346 ****
--- 1352,1360 ----
  -nr/pattern/    don't display relaying information that matches
  -nt             don't display transport information
  -nt/pattern/    don't display transport information that matches
+
+ -cd             Count duplicate deliveries seperately for each host
+
  -nvr          don't do volume rounding. Display in bytes, not KB/MB/GB.
  -q<list>        list of times for queuing information
                  single 0 item suppresses
*************** EoText
*** 1395,1401 ****
  #######################################################################
  sub generate_parser {
    my $parser = '
!   my($ip,$host,$email,$edomain,$domain,$thissize,$size,$old,$new);
    my($tod,$m_hour,$m_min,$id,$flag);
    while (<$fh>) {

--- 1409,1415 ----
  #######################################################################
  sub generate_parser {
    my $parser = '
!   my($ip,$host,$email,$edomain,$domain,$thissize,$size,$tsize,$old,$new);
    my($tod,$m_hour,$m_min,$id,$flag);
    while (<$fh>) {

*************** sub generate_parser {
*** 1557,1564 ****
        #ENDIF ($hist_opt > 0)
      }

!     elsif ($flag eq "=>") {
        $size = $size{$id} || 0;
        if ($host ne "local") {
          $remote_delivered{$id} = 1;

--- 1571,1579 ----
        #ENDIF ($hist_opt > 0)
      }

!     elsif ($flag eq "=>" || ($flag eq "->" && $count_duplicate > 0)) {
        $size = $size{$id} || 0;
+       $tsize = ($flag eq "=>") ? $size : 0;
        if ($host ne "local") {
          $remote_delivered{$id} = 1;

*************** sub generate_parser {
*** 1621,1650 ****

        #IFDEF ($do_sender{Host})
        $delivered_count{Host}{$host}++;
!       
add_volume(\\$delivered_data{Host}{$host},\\$delivered_data_gigs{Host}{$host},$size);
        #ENDIF ($do_sender{Host})
        #IFDEF ($do_sender{Domain})
          if ($domain) {
          $delivered_count{Domain}{$domain}++;
!         
add_volume(\\$delivered_data{Domain}{$domain},\\$delivered_data_gigs{Domain}{$domain},$size);
        }
        #ENDIF ($do_sender{Domain})
        #IFDEF ($do_sender{Email})
        $delivered_count{Email}{$email}++;
!       
add_volume(\\$delivered_data{Email}{$email},\\$delivered_data_gigs{Email}{$email},$size);
        #ENDIF ($do_sender{Email})
        #IFDEF ($do_sender{Edomain})
        $delivered_count{Edomain}{$edomain}++;
!       
add_volume(\\$delivered_data{Edomain}{$edomain},\\$delivered_data_gigs{Edomain}{$edomain},$size);
        #ENDIF ($do_sender{Edomain})

        $total_delivered_count++;
!       add_volume(\\$total_delivered_data,\\$total_delivered_data_gigs,$size);

        #IFDEF ($show_transport)
          my $transport = (/\\sT=(\\S+)/) ? $1 : ":blackhole:";
          $transported_count{$transport}++;
!         
add_volume(\\$transported_data{$transport},\\$transported_data_gigs{$transport},$size);
        #ENDIF ($show_transport)

        #IFDEF ($hist_opt > 0)
--- 1636,1665 ----

        #IFDEF ($do_sender{Host})
        $delivered_count{Host}{$host}++;
!       
add_volume(\\$delivered_data{Host}{$host},\\$delivered_data_gigs{Host}{$host},$tsize);
        #ENDIF ($do_sender{Host})
        #IFDEF ($do_sender{Domain})
          if ($domain) {
          $delivered_count{Domain}{$domain}++;
!         
add_volume(\\$delivered_data{Domain}{$domain},\\$delivered_data_gigs{Domain}{$domain},$tsize);
        }
        #ENDIF ($do_sender{Domain})
        #IFDEF ($do_sender{Email})
        $delivered_count{Email}{$email}++;
!       
add_volume(\\$delivered_data{Email}{$email},\\$delivered_data_gigs{Email}{$email},$tsize);
        #ENDIF ($do_sender{Email})
        #IFDEF ($do_sender{Edomain})
        $delivered_count{Edomain}{$edomain}++;
!       
add_volume(\\$delivered_data{Edomain}{$edomain},\\$delivered_data_gigs{Edomain}{$edomain},$tsize);
        #ENDIF ($do_sender{Edomain})

        $total_delivered_count++;
!       add_volume(\\$total_delivered_data,\\$total_delivered_data_gigs,$tsize);

        #IFDEF ($show_transport)
          my $transport = (/\\sT=(\\S+)/) ? $1 : ":blackhole:";
          $transported_count{$transport}++;
!         
add_volume(\\$transported_data{$transport},\\$transported_data_gigs{$transport},$tsize);
        #ENDIF ($show_transport)

        #IFDEF ($hist_opt > 0)
*************** $topcount = 50;
*** 2662,2667 ****
--- 2677,2683 ----
  $local_league_table = 1;
  $include_remote_users = 0;
  $hist_opt = 1;
+ $count_duplicate = 0;
  $volume_rounding = 1;
  $localtime_offset = calculate_localtime_offset();    # PH/FANF

*************** while (@ARGV > 0 && substr($ARGV[0], 0,
*** 2711,2716 ****
--- 2727,2733 ----
    elsif ($ARGV[0] =~ /^-chartdir$/) { $chartdir = $ARGV[1]; shift; 
$charts_option_specified = 1; }
    elsif ($ARGV[0] =~ /^-chartrel$/) { $chartrel = $ARGV[1]; shift; 
$charts_option_specified = 1; }
    elsif ($ARGV[0] =~ /^-cache$/)    { }       #Not currently used.
+   elsif ($ARGV[0] =~ /^-cd$/)       { $count_duplicate = 1 }
    elsif ($ARGV[0] =~ /^-byhost$/)   { $do_sender{Host} = 1 }
    elsif ($ARGV[0] =~ /^-bydomain$/) { $do_sender{Domain} = 1 }
    elsif ($ARGV[0] =~ /^-byemail$/)  { $do_sender{Email} = 1 }



--
## List details at http://www.exim.org/mailman/listinfo/exim-users ## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to