]> git.proxmox.com Git - pmg-api.git/commitdiff
pmgreport: add mail traffic
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Aug 2017 11:32:32 +0000 (13:32 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 22 Aug 2017 11:37:54 +0000 (13:37 +0200)
PMG/CLI/pmgreport.pm
templates/pmgreport.tt

index 0a23d5445195a7fd687b570371dd4cf279288336..90b55b1b530bf4ae67cf8a9c3f6825d4a943c9d3 100644 (file)
@@ -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,
 
index c48f63a282c15990dc23369455076bdb8cb4ab89..f3f845471c236bfd30da1bad031596476a375ddb 100644 (file)
@@ -68,7 +68,7 @@ border-collapse: collapse;
   <table>
     [% FOREACH item IN incoming %]
     <tr>
-      <td>[% item.text %] ([% item.percentage %]%)</td>
+      <td>[% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %]</td>
       <td>[% item.value %]</td>
     </tr>
     [% END %]
@@ -80,7 +80,7 @@ border-collapse: collapse;
   <table>
     [% FOREACH item IN outgoing %]
     <tr>
-      <td>[% item.text %] ([% item.percentage %]%)</td>
+      <td>[% item.text %][% IF item.percentage.defined %] ([% item.percentage %]%)[% END %]</td>
       <td>[% item.value %]</td>
     </tr>
     [% END %]