diff options
author | Peter Palfrader <peter@palfrader.org> | 2005-05-19 18:34:06 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2005-05-19 18:34:06 +0000 |
commit | 7e49291cfe686a6ef8b4a766e8a1b914095f19d6 (patch) | |
tree | e8c28006ca91a82db68fc77121c42e0a715d6df9 | |
parent | 97b0dd2437b196a7447ecf259cf7a5cd03bf6316 (diff) |
New directory format and stuff
-rwxr-xr-x | other/tor/bin/rrd-graph | 35 | ||||
-rwxr-xr-x | other/tor/bin/rrd-update | 21 |
2 files changed, 48 insertions, 8 deletions
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 .= "<p><img width=\"$xsize\" height=\"$ysize\" src=\"$IMG_URL"."total.png\"></p>"; $html .= "<p>\"Fast\" means a capacity of over 20,000 bytes/second</p>\n"; - $html .= "<p>Number of routers over the <a href=\"$IMG_URL"."total9Months.png\">last 9 months</a> | "; - $html .= " <a href=\"$IMG_URL"."totalMonthly.png\">last month</a> |"; - $html .= " <a href=\"$IMG_URL"."totalBiWeekly.png\">last 2 weeks</a></p>"; + $html .= "<p>Number of routers over the <a href=\"$IMG_URL"."total9Months.html\">last 9 months</a> | "; + $html .= " <a href=\"$IMG_URL"."totalMonthly.html\">last month</a> |"; + $html .= " <a href=\"$IMG_URL"."totalBiWeekly.html\">last 2 weeks</a></p>"; }; @@ -354,9 +354,9 @@ if ($totalTraffic[0] ne 'MAGIX1' || $totalTraffic[1] ne 'MAGIX2') { warn RRDs::error if RRDs::error; $html .= "<p><img width=\"$xsize\" height=\"$ysize\" src=\"$IMG_URL"."totalTraffic.png\"></p>"; - $html .= "<p>Bandwidth usage for <a href=\"$IMG_URL"."totalTraffic9Months.png\">last 9 months</a> | "; - $html .= " <a href=\"$IMG_URL"."totalTrafficMonthly.png\">last month</a> |"; - $html .= " <a href=\"$IMG_URL"."totalTrafficBiWeekly.png\">last 2 weeks</a></p>"; + $html .= "<p>Bandwidth usage for <a href=\"$IMG_URL"."totalTraffic9Months.html\">last 9 months</a> | "; + $html .= " <a href=\"$IMG_URL"."totalTrafficMonthly.html\">last month</a> |"; + $html .= " <a href=\"$IMG_URL"."totalTrafficBiWeekly.html\">last 2 weeks</a></p>"; } @@ -411,3 +411,26 @@ print F "<html><head><title>Older Tor Routers</title></head><body>", "<a href=\"mailto:web\@palfrader.org\">Peter Palfrader <web\@palfrader.org></a>\n", "</body></html>\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 "<html><head><title>$imgs{$key}</title></head><body>", + "<h1>$imgs{$key}</h1>", + "<a href=\".\">back</a>", + "<p>", + "<img src=\"$key.png\">", + "<br><br><br>\n", + "<hr>\nBuilt at $GMTIME on $HOSTNAME<br>\n", + "<a href=\"mailto:web\@palfrader.org\">Peter Palfrader <web\@palfrader.org></a>\n", + "</body></html>\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 (<DIRECTORY>) { $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; |