[!
use strict;
use Proxmox::Utils;
use Proxmox::RuleDB;
use Proxmox::HTMLTable;
use Proxmox::HTMLDropDown;
use Proxmox::Statistic;
!]
[- Execute ('date_selection.epl'); -]
[-
my $stat = Proxmox::Statistic->new ($udat{statistic_from}, $udat{statistic_to});
my $timediff = $udat{statistic_to} - $udat{statistic_from};
$timediff = $timediff > 1 ? $timediff : 1;
my @cellwidth = ('250px', '150','340px');
my $table_sum = Proxmox::HTMLTable->new (\@cellwidth);
my $table_bad = Proxmox::HTMLTable->new (\@cellwidth);
my $rdb = Proxmox::RuleDB->new();
Proxmox::Statistic::update_stats_dailystat ($rdb->{dbh}, $fdat{__cinfo});
my $sres = $stat->total_mail_stat ($rdb);
my $width = 200;
my @header_sum = ('3', '200px', __('General Mail Statistics'));
my @header_bad = ('1', '250px', sprintf (__("Junk Mails") . " (%.1f%)", $sres->{junk_in_per}),
'1', '150px', "$sres->{junk_in}",
'1', '340px', $stat->out_bar (1, $sres->{junk_in_per}*$width/100) || " ");
$table_sum->add_headline (\@header_sum);
$table_bad->add_headline (\@header_bad);
$table_sum->add_row ('', __("Total Mails"), $sres->{count}, $stat->out_bar (0, $width));
$table_sum->add_row ('', sprintf (__("Incoming Mails") . " (%.1f%)" , $sres->{count_in_per}),
$sres->{count_in}, $stat->out_bar (2, $sres->{count_in_per}*$width/100));
$table_sum->add_row ('', sprintf (__("Outgoing Mails") . " (%.1f%)", $sres->{count_out_per}),
$sres->{count_out}, $stat->out_bar (3,$sres->{count_out_per}*$width/100));
$table_sum->add_row ('', __("Virus Outbreaks"), $sres->{viruscount_out}, "") if $sres->{viruscount_out};
my $ptime = sprintf ("%.3f seconds", $sres->{avptime});
$table_sum->add_row ('', __("Avg. Mail Processing Time"), $ptime, "");
my $total_traff_in = $sres->{traffic_in};
my $mi = sprintf("%.3f MByte",$total_traff_in);
my $traff_in = sprintf ("%.1f Bytes/sec", ($total_traff_in*1024*1024)/$timediff);
$table_sum->add_row ('', __("Incoming Mail Traffic"), $mi, $traff_in);
my $total_traff_out = $sres->{traffic_out};
my $mo = sprintf("%.3f MByte",$total_traff_out);
my $traff_out = sprintf ("%.1f Bytes/sec", ($total_traff_out*1024*1024)/$timediff);
$table_sum->add_row ('', __("Outgoing Mail Traffic"), $mo, $traff_out);
$table_bad->add_row ('', sprintf (__("Greylisted Mails") . " (%.1f%)", $sres->{glcount_per}),
$sres->{glcount}, $stat->out_bar (4, $sres->{glcount_per}*$width/100));
$table_bad->add_row ('', sprintf (__("Spam Mails") . " (%.1f%)", $sres->{spamcount_in_per}),
$sres->{spamcount_in}, $stat->out_bar (3, $sres->{spamcount_in_per}*$width/100));
$table_bad->add_row ('', sprintf (__("SPF rejects") . " (%.1f%)", $sres->{spfcount_per}),
$sres->{spfcount}, $stat->out_bar (5, $sres->{spfcount_per}*$width/100));
$table_bad->add_row ('', sprintf (__("Virus Mails") . " (%.1f%)", $sres->{viruscount_in_per}),
$sres->{viruscount_in}, $stat->out_bar (2, $sres->{viruscount_in_per}*$width/100));
my $out = $table_sum->out_table() . "
" . $table_bad->out_table();
print OUT $out;
-]