From 7e49291cfe686a6ef8b4a766e8a1b914095f19d6 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 19 May 2005 18:34:06 +0000 Subject: New directory format and stuff --- other/tor/bin/rrd-graph | 35 +++++++++++++++++++++++++++++------ other/tor/bin/rrd-update | 21 +++++++++++++++++++-- 2 files changed, 48 insertions(+), 8 deletions(-) (limited to 'other') diff --git a/other/tor/bin/rrd-graph b/other/tor/bin/rrd-graph index 63c5c43..bd4cc05 100755 --- a/other/tor/bin/rrd-graph +++ b/other/tor/bin/rrd-graph @@ -319,9 +319,9 @@ if ($params[0] ne 'MAGIX1' || $params[1] ne 'MAGIX2') { $html .= "

"; $html .= "

\"Fast\" means a capacity of over 20,000 bytes/second

\n"; - $html .= "

Number of routers over the last 9 months | "; - $html .= " last month |"; - $html .= " last 2 weeks

"; + $html .= "

Number of routers over the last 9 months | "; + $html .= " last month |"; + $html .= " last 2 weeks

"; }; @@ -354,9 +354,9 @@ if ($totalTraffic[0] ne 'MAGIX1' || $totalTraffic[1] ne 'MAGIX2') { warn RRDs::error if RRDs::error; $html .= "

"; - $html .= "

Bandwidth usage for last 9 months | "; - $html .= " last month |"; - $html .= " last 2 weeks

"; + $html .= "

Bandwidth usage for last 9 months | "; + $html .= " last month |"; + $html .= " last 2 weeks

"; } @@ -411,3 +411,26 @@ print F "Older Tor Routers", "Peter Palfrader <web\@palfrader.org>\n", "\n"; close F; + + +my %imgs = ( + total9Months => 'Number of routers over the last 9 months', + totalMonthly => 'Number of routers over the last month', + totalBiWeekly => 'Number of routers over the last 2 weeks', + totalTraffic9Months => 'Traffic over the last 9 months', + totalTrafficMonthly => 'Traffic over the last month', + totalTrafficBiWeekly => 'Traffic over the last 2 weeks' ); + +for my $key (keys %imgs) { + open (F, ">$RESULT_DIR/$key.html") or die ("Cannot open $key.html: $!\n"); + print F "$imgs{$key}", + "

$imgs{$key}

", + "back", + "

", + "", + "


\n", + "


\nBuilt at $GMTIME on $HOSTNAME
\n", + "Peter Palfrader <web\@palfrader.org>\n", + "\n"; + close F; +}; diff --git a/other/tor/bin/rrd-update b/other/tor/bin/rrd-update index 885eef3..7151641 100755 --- a/other/tor/bin/rrd-update +++ b/other/tor/bin/rrd-update @@ -19,7 +19,7 @@ sub check_exists_running($$) { my ($rrd, $global) = @_; return if (-e $rrd); my @params = ($rrd); - push @params, '-b', 'now - 12 months', + push @params, '-b', 'now - 24 months', qw{ --step 3600 DS:runningVerified:GAUGE:172800:U:U DS:runningUnverified:GAUGE:172800:U:U @@ -50,7 +50,7 @@ sub check_exists_traffic($) { my ($rrd) = @_; return if (-e $rrd); my @params = ($rrd); - push @params, '-b', 'now - 8 months', + push @params, '-b', 'now - 12 months', qw{ --step 900 DS:write:ABSOLUTE:900:U:U DS:read:ABSOLUTE:900:U:U @@ -120,6 +120,7 @@ for my $dir (@dirfiles) { # running-routers moria1 moria2 peacetime metacolo ovmja.... my $dir_published = undef; my $running_routers = undef; + my $router_status = undef; my $linenr = 0; while () { $linenr++; @@ -140,8 +141,24 @@ for my $dir (@dirfiles) { next; }; }; + if (/^router-status\s*(.*?)\s*$/) { + if (!defined $router_status) { + $router_status = $1 + } else { + warn ("router_status already set to '$router_status' in directory $dir, line $linenr\n"); + next; + }; + }; last if (/^\s*$/); }; + die ("Didn't find published for directory") unless defined $dir_published; + die ("Didn't find running-routers or router-status") unless (defined $running_routers or $router_status); + + if (defined $router_status && !defined $running_routers) { + $router_status =~ s/=\S+//g; + $running_routers = $router_status; + }; + my $current_router = undef; my $current_platform = undef; -- cgit v1.2.3