summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--NEWS1
-rwxr-xr-xdebian/echolot.init2
-rw-r--r--doc/pingd.conf.pod7
-rwxr-xr-xpingd15
-rwxr-xr-xtools/pingctl2
9 files changed, 83 insertions, 9 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
diff --git a/NEWS b/NEWS
index 2af9dac..2de218d 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ Changes in version
This helps additional tools to utilize Echolot's data.
* Compile a list of default From: lines as well as a list of
remailers which allow user supplied From headers.
+ * Print status summary to log daily.
Changes in version 2.0.10 - 2003-02-03
* Return undef rather than 0 if we cannot open a Maildir.
diff --git a/debian/echolot.init b/debian/echolot.init
index 709eb9d..29c89c9 100755
--- a/debian/echolot.init
+++ b/debian/echolot.init
@@ -134,7 +134,7 @@ reload|force-reload|restart)
wait_for_deaddaemon $PID
$0 start
;;
-process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf)
+process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary)
# Check for right User
SU=""
if [ "$CHECKUID" -gt "0" ]; then
diff --git a/doc/pingd.conf.pod b/doc/pingd.conf.pod
index 99a2fd0..851569f 100644
--- a/doc/pingd.conf.pod
+++ b/doc/pingd.conf.pod
@@ -428,6 +428,13 @@ How many backups of metadata to keep.
Default: 'metadata_backup_count' => 32, # keep the last 32 backups
Example: 'metadata_backup_count' => 4, # keep 4 rotations
+=item B<summary> [seconds]
+
+How often to print a status summary to the log.
+
+ Default: 'summary' => 24*60*60, # daily
+ Default: 'summary' => 12*60*60, # twice a day
+
=back
diff --git a/pingd b/pingd
index 1c3c3f6..2d6977c 100755
--- a/pingd
+++ b/pingd
@@ -3,7 +3,7 @@
$| = 1;
# (c) 2002, 2003 Peter Palfrader <peter@palfrader.org>
-# $Id: pingd,v 1.99 2003/02/18 06:57:07 weasel Exp $
+# $Id: pingd,v 1.100 2003/02/20 19:39:03 weasel Exp $
#
=pod
@@ -156,6 +156,10 @@ Send a command to immediatly rebuild the Thesaurus.
Send a command to immediatly rebuild the From Header lines page.
+=item B<summary>
+
+Print a status summary of all known addresses to the log.
+
=item B<dumpconf>
Dumps the current configuration to standard output.
@@ -191,7 +195,7 @@ Print version number and exit sucessfully.
Usefull only with the B<add>, B<set>, B<setremailercaps>,
B<deleteremailercaps>, B<getkeyconf>, B<sendpings>, B<buildstats>,
-B<buildkeys>, B<buildthesaurus>, or B<buildfromlines> command.
+B<buildkeys>, B<buildthesaurus>, B<buildfromlines> or B<summary> command.
Don't send a HUP signal to the daemon which instructs it to process the
commands after adding the command to the task list.
@@ -297,6 +301,7 @@ use Echolot::Stats;
use Echolot::Commands;
use Echolot::Thesaurus;
use Echolot::Fromlines;
+use Echolot::Report;
use Echolot::Log;
use POSIX qw(setsid);
@@ -521,6 +526,8 @@ sub daemon_run($) {
$scheduler->add('getkeyconf' , Echolot::Config::get()->{'getkeyconf_interval'} , 0, \&Echolot::Conf::send_requests );
$scheduler->add('check_resurrection' , Echolot::Config::get()->{'check_resurrection'} , 0, \&Echolot::Conf::check_resurrection );
+ $scheduler->add('summary' , Echolot::Config::get()->{'summary'} , 0, \&Echolot::Report::print_summary );
+
Echolot::Globals::get()->{'scheduler'}->schedule('readcommands', 0, time() )
if ($process);
@@ -648,6 +655,7 @@ if ($params->{'help'}) {
print (" buildkeys ... buid keyrings immediatly\n");
print (" buildthesaurus ... build thesaurus immediatly\n");
print (" buildfromlines ... build fromlines immediatly\n");
+ print (" summary ... print status summary to log\n");
print (" dumpconf dump configuration\n");
exit 0;
};
@@ -698,6 +706,9 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') {
} elsif ($COMMAND eq 'buildfromlines') {
Echolot::Commands::addCommand("buildfromlines");
hup_if_wanted($params->{'nohup'});
+} elsif ($COMMAND eq 'summary') {
+ Echolot::Commands::addCommand("summary");
+ hup_if_wanted($params->{'nohup'});
} elsif ($COMMAND eq 'process') {
daemon_hup();
} elsif ($COMMAND eq 'stop') {
diff --git a/tools/pingctl b/tools/pingctl
index dc63e31..3a3ede6 100755
--- a/tools/pingctl
+++ b/tools/pingctl
@@ -94,7 +94,7 @@ reload|force-reload|restart)
sleep 10
$0 start
;;
-process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf)
+process|add|delete|set|setremailercaps|deleteremailercaps|getkeyconf|sendpings|buildstats|buildkeys|buildthesaurus|buildfromlines|dumpconf|summary)
echo "Running pingd $1..."
if [ ! -z "$SU" ]; then
$SU "$PINGD \"$@\""