From 7264942e10f7fa6fe432adb21c2b40f87b7060b8 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 22 Aug 2017 13:32:32 +0200 Subject: [PATCH] pmgreport: add mail traffic --- PMG/CLI/pmgreport.pm | 9 +++++---- templates/pmgreport.tt | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/PMG/CLI/pmgreport.pm b/PMG/CLI/pmgreport.pm index 0a23d54..90b55b1 100644 --- a/PMG/CLI/pmgreport.pm +++ b/PMG/CLI/pmgreport.pm @@ -178,14 +178,14 @@ __PACKAGE__->register_method ({ PMG::Statistic::update_stats($rdb->{dbh}, $cinfo); my $totals = $stat->total_mail_stat($rdb); - print Dumper($totals); # Generate data for incoming mails my $data = []; push @$data, { text => 'Incoming Mails', value => $totals->{count_in}, percentage => $totals->{count_in_per} }; - push @$data, { text => 'Spam Mails', value => $totals->{spamcount_in}, percentage => $totals->{spamcount_in_per}}; - push @$data, { text => 'Virus Mails', value => $totals->{viruscount_in}, percentage => $totals->{viruscount_in_per}}; - push @$data, { text => 'SPF rejects', value => $totals->{spfcount}, percentage => $totals->{spfcount_per}}; + push @$data, { text => 'Spam Mails', value => $totals->{spamcount_in}, percentage => $totals->{spamcount_in_per} }; + push @$data, { text => 'Virus Mails', value => $totals->{viruscount_in}, percentage => $totals->{viruscount_in_per} }; + push @$data, { text => 'SPF rejects', value => $totals->{spfcount}, percentage => $totals->{spfcount_per} }; + push @$data, { text => 'Mail Traffic', value => sprintf ("%.3f MByte", $totals->{traffic_in}) }; $vars->{incoming} = $data, @@ -193,6 +193,7 @@ __PACKAGE__->register_method ({ $data = []; push @$data, { text => 'Outgoing Mails', value => $totals->{count_out}, percentage => $totals->{count_out_per} }; push @$data, { text => 'Bounces', value => $totals->{bounces_out}, percentage => $totals->{bounces_out_per} }; + push @$data, { text => 'Mail Traffic', value => sprintf ("%.3f MByte", $totals->{traffic_out}) }; $vars->{outgoing} = $data, diff --git a/templates/pmgreport.tt b/templates/pmgreport.tt index c48f63a..f3f8454 100644 --- a/templates/pmgreport.tt +++ b/templates/pmgreport.tt @@ -68,7 +68,7 @@ border-collapse: collapse; [% FOREACH item IN incoming %] - + [% END %] @@ -80,7 +80,7 @@ border-collapse: collapse;
[% item.text %] ([% item.percentage %]%)[% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %] [% item.value %]
[% FOREACH item IN outgoing %] - + [% END %] -- 2.39.5
[% item.text %] ([% item.percentage %]%)[% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %] [% item.value %]