diff options
author | Peter Palfrader <peter@palfrader.org> | 2003-02-20 19:39:04 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2003-02-20 19:39:04 +0000 |
commit | e59d79e546de5a91accbe0924b56220969a489fb (patch) | |
tree | 00d7f52b85c60a9737db33ced56252b076a27dea /Echolot/Report.pm | |
parent | 18a1444d32eb29599865fdb651cc73ab846300e7 (diff) |
Print status summary to log dailysnapshot/2003-02-20
Diffstat (limited to 'Echolot/Report.pm')
-rw-r--r-- | Echolot/Report.pm | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Echolot/Report.pm b/Echolot/Report.pm new file mode 100644 index 0000000..8df112a --- /dev/null +++ b/Echolot/Report.pm @@ -0,0 +1,46 @@ +package Echolot::Report; + +# (c) 2002 Peter Palfrader <peter@palfrader.org> +# $Id: Report.pm,v 1.1 2003/02/20 19:39:03 weasel Exp $ +# + +=pod + +=head1 Name + +Echolot::Report - Summarize status of remailers + +=head1 DESCRIPTION + +This package prints the summary of remailers/addresses. + +=cut + +use strict; +use English; +use Echolot::Log; + +sub print_summary() { + + my @addresses = sort { $a->{'address'} cmp $b->{'address'} } Echolot::Globals::get()->{'storage'}->get_addresses(); + my %remailers = map { $_->{'address'} => $_ } Echolot::Globals::get()->{'storage'}->get_remailers(); + my $report = "*** Status summary ***\n"; + + for my $remailer (@addresses) { + my $addr = $remailer->{'address'}; + $report .= "$addr (ID: $remailer->{'id'}): ".uc($remailer->{'status'})."; Fetch/Ping/Show: $remailer->{'fetch'}$remailer->{'pingit'}$remailer->{'showit'}; TTL: $remailer->{'ttl'}\n"; + $report .= " Resurection TTL: $remailer->{'resurrection_ttl'}\n" if (defined $remailer->{'resurrection_ttl'} && ($remailer->{'status'} eq 'ttl timeout')); + if (defined $remailers{$addr}) { + $report .= " $remailers{$addr}->{'status'}\n"; + for my $type (Echolot::Globals::get()->{'storage'}->get_types($addr)) { + $report .= " Type: $type: ".join(', ', Echolot::Globals::get()->{'storage'}->get_keys($addr, $type))."\n"; + }; + }; + }; + Echolot::Log::info($report); + + return 1; +}; + +1; +# vim: set ts=4 shiftwidth=4: |