summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-02-20 19:39:04 +0000
committerPeter Palfrader <peter@palfrader.org>2003-02-20 19:39:04 +0000
commite59d79e546de5a91accbe0924b56220969a489fb (patch)
tree00d7f52b85c60a9737db33ced56252b076a27dea /Echolot
parent18a1444d32eb29599865fdb651cc73ab846300e7 (diff)
Print status summary to log dailysnapshot/2003-02-20
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Commands.pm4
-rw-r--r--Echolot/Config.pm3
-rw-r--r--Echolot/Report.pm46
-rw-r--r--Echolot/Storage/File.pm12
4 files changed, 60 insertions, 5 deletions
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm
index e0d7e5e..0ae4bf9 100644
--- a/Echolot/Commands.pm
+++ b/Echolot/Commands.pm
@@ -1,7 +1,7 @@
package Echolot::Commands;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Commands.pm,v 1.13 2003/02/18 06:38:07 weasel Exp $
+# $Id: Commands.pm,v 1.14 2003/02/20 19:39:03 weasel Exp $
#
=pod
@@ -79,6 +79,8 @@ sub processCommands($) {
Echolot::Globals::get()->{'scheduler'}->schedule('buildthesaurus', 0, time() );
} elsif ($command eq 'buildfromlines') {
Echolot::Globals::get()->{'scheduler'}->schedule('buildfromlines', 0, time() );
+ } elsif ($command eq 'summary') {
+ Echolot::Globals::get()->{'scheduler'}->schedule('summary', 0, time() );
} elsif ($command eq 'delete') {
Echolot::Globals::get()->{'storage'}->delete_remailer(@args);
} elsif ($command eq 'setremailercaps') {
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index 70b7523..c64f295 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.60 2003/02/18 06:57:07 weasel Exp $
+# $Id: Config.pm,v 1.61 2003/02/20 19:39:03 weasel Exp $
#
=pod
@@ -95,6 +95,7 @@ sub init($) {
getkeyconf_interval => 5*60, # send out requests every 5 minutes
getkeyconf_every_nth_time => 24*60/5, # send out the same request to the same remailer once a day
check_resurrection => 7*24*60*60, # weekly
+ summary => 24*60*60, # daily
metadata_backup => 8*60*60, # make backups of metadata and rotate them every 8 hours
metadata_backup_count => 32, # keep 32 rotations of metadata
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:
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index aea5574..7bd668b 100644
--- a/Echolot/Storage/File.pm
+++ b/Echolot/Storage/File.pm
@@ -1,7 +1,7 @@
package Echolot::Storage::File;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: File.pm,v 1.54 2003/02/20 14:05:38 weasel Exp $
+# $Id: File.pm,v 1.55 2003/02/20 19:39:03 weasel Exp $
#
=pod
@@ -952,7 +952,11 @@ The hash has the following keys:
=item fetch
-=item shoit
+=item showit
+
+=item pingit
+
+=item ttl
=item resurrection_ttl
@@ -974,6 +978,8 @@ sub get_address($$) {
address => $_,
fetch => $self->{'METADATA'}->{'addresses'}->{$addr}->{'fetch'},
showit => $self->{'METADATA'}->{'addresses'}->{$addr}->{'showit'},
+ pingit => $self->{'METADATA'}->{'addresses'}->{$addr}->{'pingit'},
+ ttl => $self->{'METADATA'}->{'addresses'}->{$addr}->{'ttl'},
resurrection_ttl => $self->{'METADATA'}->{'addresses'}->{$addr}->{'resurrection_ttl'},
};
@@ -1443,7 +1449,7 @@ I<$remailer>.
Returns undef on errors.
=cut
-sub get_keys($$) {
+sub get_keys($$$) {
my ($self, $remailer, $type) = @_;
defined ($self->{'METADATA'}->{'remailers'}->{$remailer}) or