More of the same.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@430 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-06-08 22:25:28 +00:00
parent 1f036fee90
commit 9fbf25a708
2 changed files with 15 additions and 11 deletions

View File

@ -157,17 +157,7 @@ sub cmd_status {
if (defined &Qpsmtpd::Plugin::stats::register) { if (defined &Qpsmtpd::Plugin::stats::register) {
# Stats plugin is loaded # Stats plugin is loaded
my $uptime = Qpsmtpd::Plugin::stats->uptime; $output .= Qpsmtpd::Plugin::stats->get_stats;
my $recvd = Qpsmtpd::Plugin::stats->mails_received;
my $reject = Qpsmtpd::Plugin::stats->mails_rejected;
my $soft = Qpsmtpd::Plugin::stats->mails_tempfailed;
my $rate = Qpsmtpd::Plugin::stats->mails_per_sec;
$output .= sprintf(" Uptime: %0.2f sec\n".
" Mails Received: % 10d\n".
" 5xx: % 10d\n".
" 4xx: % 10d\n".
"Mails per second: %0.2f\n",
$uptime, $recvd, $reject, $soft, $rate);
} }
my $descriptors = Danga::Socket->DescriptorMap; my $descriptors = Danga::Socket->DescriptorMap;

View File

@ -15,6 +15,20 @@ sub register {
$self->register_hook('queue', 'increment_mails'); $self->register_hook('queue', 'increment_mails');
} }
sub get_stats {
my $uptime = Qpsmtpd::Plugin::stats->uptime;
my $recvd = Qpsmtpd::Plugin::stats->mails_received;
my $reject = Qpsmtpd::Plugin::stats->mails_rejected;
my $soft = Qpsmtpd::Plugin::stats->mails_tempfailed;
my $rate = Qpsmtpd::Plugin::stats->mails_per_sec;
return sprintf(" Uptime: %0.2f sec\n".
" Mails Received: % 10d\n".
" 5xx: % 10d\n".
" 4xx: % 10d\n".
"Mails per second: %0.2f\n",
$uptime, $recvd, $reject, $soft, $rate);
}
sub increment_deny { sub increment_deny {
my ($self, $tran, $plugin, $level) = @_; my ($self, $tran, $plugin, $level) = @_;