From a88af8c65066a71ab10fb7789cb94275879bfaec Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 11 Sep 2005 22:39:40 +0000 Subject: Make long be 15 months, move pictures into their own html files more stuff --- other/tor/Makefile | 3 +- other/tor/bin/rrd-graph | 306 +++++++++++++++++++++++------------------------ other/tor/bin/rrd-update | 1 - 3 files changed, 149 insertions(+), 161 deletions(-) (limited to 'other') diff --git a/other/tor/Makefile b/other/tor/Makefile index e08ee8e..a10f38c 100644 --- a/other/tor/Makefile +++ b/other/tor/Makefile @@ -2,7 +2,8 @@ TODAY=`TZ=UTC date +'%Y-%m-%d_%H:%M:%S'` WGET=wget --cache=off OUTDIR=tor-directory #SOURCE=http://moria.mit.edu:9031/ -SOURCE=http://tor.noreply.org:9030/ +#SOURCE=http://tor.noreply.org:9030/ +SOURCE=http://tor.noreply.org:80/tor/ TMPFILE=download.tmp LAST_NAME=dir.last diff --git a/other/tor/bin/rrd-graph b/other/tor/bin/rrd-graph index bd4cc05..2940f7c 100755 --- a/other/tor/bin/rrd-graph +++ b/other/tor/bin/rrd-graph @@ -2,7 +2,6 @@ use strict; use RRDs; -use BER; my $HOSTNAME = `hostname`; @@ -18,6 +17,7 @@ my $RRD = '/home/weasel/www/www.noreply.org/Build/other/tor/rrd/running_Routers. my $RRD_DIR = '/home/weasel/www/www.noreply.org/Build/other/tor/rrd/nodes'; my $INDEX_DIR = '/home/weasel/www/www.noreply.org/Build/other/tor/index'; my $RESULT_DIR = 'result.new'; +my $LONG_TIME_MONTHS = 15; # Get list of RRD files opendir(D,$RRD_DIR) or die ("Cannot opendir $RRD_DIR: $!\n"); @@ -58,64 +58,8 @@ for my $hash (@NAME) { $a cmp $b } @SOURCES; -my @params = 'MAGIX1'; -push @params, sprintf('MAGIX2'); -push @params, sprintf('-e %s', $END_AT); -#push @params, sprintf('-e %s', $NOW- 2*24*3600); -push @params, sprintf('-t %s', "Running routers"); -push @params, sprintf('-aPNG'); -push @params, sprintf('-v %s', "# Routers"); -#push @params, sprintf('-w %d', 600); -#push @params, sprintf('-h %d', 400); -push @params, sprintf('-w %d', 497); -push @params, sprintf('-h %d', 301); -#push @params, sprintf('-h %d', 271); - -push @params, sprintf('DEF:%s=%s:%s:%s', 'd_runningVerified' , $RRD, 'runningVerified', 'AVERAGE'); -push @params, sprintf('CDEF:%s=%s' , 'c_runningVerified' , 'd_runningVerified'); -push @params, sprintf('DEF:%s=%s:%s:%s', 'd_runningUnverified' , $RRD, 'runningUnverified', 'AVERAGE'); -push @params, sprintf('CDEF:%s=%s' , 'c_runningUnverified' , 'd_runningUnverified'); -push @params, sprintf('DEF:%s=%s:%s:%s', 'd_exit80Verified' , $RRD, 'exit80Verified', 'AVERAGE'); -push @params, sprintf('CDEF:%s=%s' , 'c_exit80Verified' , 'd_exit80Verified'); - -push @params, sprintf('DEF:%s=%s:%s:%s', 'd_f_runningVerified' , $RRD, 'fastRunningVerified', 'AVERAGE'); -push @params, sprintf('CDEF:%s=%s' , 'c_f_runningVerified' , 'd_f_runningVerified'); -push @params, sprintf('DEF:%s=%s:%s:%s', 'd_f_runningUnverified' , $RRD, 'fastRunningUnverifi', 'AVERAGE'); -push @params, sprintf('CDEF:%s=%s' , 'c_f_runningUnverified' , 'd_f_runningUnverified'); -push @params, sprintf('DEF:%s=%s:%s:%s', 'd_f_exit80Verified' , $RRD, 'fastExit80Verified', 'AVERAGE'); -push @params, sprintf('CDEF:%s=%s' , 'c_f_exit80Verified' , 'd_f_exit80Verified'); - -#push @params, sprintf('%s:%s#%s:%s' , 'AREA' , 'c_runningVerified' , '7777FF', 'verified Nodes' ); -#push @params, sprintf('%s:%s#%s:%s' , 'STACK' , 'c_runningUnverified' , 'FF7700', 'unverified Nodes' ); -#push @params, sprintf('%s:%s#%s:%s' , 'LINE3' , 'c_exit80Verified' , '00FF00', 'verified Nodes exiting to port 80' ); -push @params, sprintf('%s:%s#%s:%s' , 'AREA' , 'c_runningVerified' , 'AAAAFF', 'verified Nodes' ); -push @params, sprintf('%s:%s#%s:%s' , 'STACK' , 'c_runningUnverified' , 'FF7700', '+unverified Nodes' ); -push @params, sprintf('%s:%s#%s:%s' , 'LINE2' , 'c_exit80Verified' , 'BBFFBB', 'verified Nodes exiting to port 80' ); - -push @params, sprintf('%s:%s#%s:%s' , 'LINE3' , 'c_f_runningVerified' , '0000FF', 'fast verified Nodes' ); -push @params, sprintf('%s:%s#%s:%s' , 'STACK' , 'c_f_runningUnverified' , 'FF0000', '+fast unverified Nodes' ); -push @params, sprintf('%s:%s#%s:%s' , 'LINE3' , 'c_f_exit80Verified' , '00FF00', 'fast verified Nodes exiting to port 80' ); - -push @params, sprintf('CDEF:%s=d_runningVerified,0,*,%s,+' , 'zeroline' , '0'); -push @params, sprintf('%s:%s' , 'LINE1' , 'zeroline' ); - - - -my @totalTraffic = 'MAGIX1'; -push @totalTraffic, sprintf('MAGIX2'); -#push @totalTraffic, sprintf('-s %s', $START_AT); -push @totalTraffic, sprintf('-e %s', $END_AT); -#push @totalTraffic, sprintf('-e %s', $NOW- 2*24*3600); -push @totalTraffic, sprintf('-t %s', "Total Traffic"); -push @totalTraffic, sprintf('-aPNG'); -push @totalTraffic, sprintf('-v %s', "Bandwidth Used"); -#push @totalTraffic, sprintf('-w %d', 600); -#push @totalTraffic, sprintf('-h %d', 400); -push @totalTraffic, sprintf('-w %d', 497); -push @totalTraffic, sprintf('-h %d', 201); -#push @totalTraffic, sprintf('-h %d', 301); -#push @totalTraffic, sprintf('-h %d', 271); +my @nodesTraffic = (); my %body; my %index; @@ -179,38 +123,38 @@ for my $source (@SOURCES) { if (-e $source_traffic) { $traf_item_counter++; - push @totalTraffic, sprintf('DEF:read%d=%s:read:AVERAGE', $traf_item_counter, $source_traffic); - push @totalTraffic, sprintf('DEF:write%d=%s:write:AVERAGE', $traf_item_counter, $source_traffic); - push @totalTraffic, sprintf('DEF:max_read%d=%s:read:MAX', $traf_item_counter, $source_traffic); - push @totalTraffic, sprintf('DEF:max_write%d=%s:write:MAX', $traf_item_counter, $source_traffic); - #push @totalTraffic, sprintf('DEF:min_read%d=%s:read:MIN', $traf_item_counter, $source_traffic); - #push @totalTraffic, sprintf('DEF:min_write%d=%s:write:MIN', $traf_item_counter, $source_traffic); - push @totalTraffic, sprintf('DEF:max_capacity%d=%s:capacity:MAX', $traf_item_counter, $source); - - push @totalTraffic, sprintf('CDEF:cleanread%d=read%d,UN,0,read%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:cleanwrite%d=write%d,UN,0,write%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:max_cleanread%d=max_read%d,UN,0,max_read%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:max_cleanwrite%d=max_write%d,UN,0,max_write%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); - #push @totalTraffic, sprintf('CDEF:min_cleanread%d=min_read%d,UN,0,min_read%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); - #push @totalTraffic, sprintf('CDEF:min_cleanwrite%d=min_write%d,UN,0,min_write%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:max_cleancapacity%d=max_capacity%d,UN,0,max_capacity%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('DEF:read%d=%s:read:AVERAGE', $traf_item_counter, $source_traffic); + push @nodesTraffic, sprintf('DEF:write%d=%s:write:AVERAGE', $traf_item_counter, $source_traffic); + push @nodesTraffic, sprintf('DEF:max_read%d=%s:read:MAX', $traf_item_counter, $source_traffic); + push @nodesTraffic, sprintf('DEF:max_write%d=%s:write:MAX', $traf_item_counter, $source_traffic); + #push @nodesTraffic, sprintf('DEF:min_read%d=%s:read:MIN', $traf_item_counter, $source_traffic); + #push @nodesTraffic, sprintf('DEF:min_write%d=%s:write:MIN', $traf_item_counter, $source_traffic); + push @nodesTraffic, sprintf('DEF:max_capacity%d=%s:capacity:MAX', $traf_item_counter, $source); + + push @nodesTraffic, sprintf('CDEF:cleanread%d=read%d,UN,0,read%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:cleanwrite%d=write%d,UN,0,write%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:max_cleanread%d=max_read%d,UN,0,max_read%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:max_cleanwrite%d=max_write%d,UN,0,max_write%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + #push @nodesTraffic, sprintf('CDEF:min_cleanread%d=min_read%d,UN,0,min_read%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + #push @nodesTraffic, sprintf('CDEF:min_cleanwrite%d=min_write%d,UN,0,min_write%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:max_cleancapacity%d=max_capacity%d,UN,0,max_capacity%d,IF', $traf_item_counter, $traf_item_counter, $traf_item_counter); if ($traf_item_counter == 1) { - push @totalTraffic, sprintf('CDEF:aggread%d=cleanread%d', $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:aggwrite%d=cleanwrite%d', $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:max_aggread%d=max_cleanread%d', $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:max_aggwrite%d=max_cleanwrite%d', $traf_item_counter, $traf_item_counter); - #push @totalTraffic, sprintf('CDEF:min_aggread%d=min_cleanread%d', $traf_item_counter, $traf_item_counter); - #push @totalTraffic, sprintf('CDEF:min_aggwrite%d=min_cleanwrite%d', $traf_item_counter, $traf_item_counter); - push @totalTraffic, sprintf('CDEF:max_aggcapacity%d=max_cleancapacity%d', $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:aggread%d=cleanread%d', $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:aggwrite%d=cleanwrite%d', $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:max_aggread%d=max_cleanread%d', $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:max_aggwrite%d=max_cleanwrite%d', $traf_item_counter, $traf_item_counter); + #push @nodesTraffic, sprintf('CDEF:min_aggread%d=min_cleanread%d', $traf_item_counter, $traf_item_counter); + #push @nodesTraffic, sprintf('CDEF:min_aggwrite%d=min_cleanwrite%d', $traf_item_counter, $traf_item_counter); + push @nodesTraffic, sprintf('CDEF:max_aggcapacity%d=max_cleancapacity%d', $traf_item_counter, $traf_item_counter); } else { - push @totalTraffic, sprintf('CDEF:aggread%d=cleanread%d,aggread%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); - push @totalTraffic, sprintf('CDEF:aggwrite%d=cleanwrite%d,aggwrite%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); - push @totalTraffic, sprintf('CDEF:max_aggread%d=max_cleanread%d,max_aggread%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); - push @totalTraffic, sprintf('CDEF:max_aggwrite%d=max_cleanwrite%d,max_aggwrite%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); - #push @totalTraffic, sprintf('CDEF:min_aggread%d=min_cleanread%d,min_aggread%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); - #push @totalTraffic, sprintf('CDEF:min_aggwrite%d=min_cleanwrite%d,min_aggwrite%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); - push @totalTraffic, sprintf('CDEF:max_aggcapacity%d=max_cleancapacity%d,max_aggcapacity%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + push @nodesTraffic, sprintf('CDEF:aggread%d=cleanread%d,aggread%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + push @nodesTraffic, sprintf('CDEF:aggwrite%d=cleanwrite%d,aggwrite%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + push @nodesTraffic, sprintf('CDEF:max_aggread%d=max_cleanread%d,max_aggread%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + push @nodesTraffic, sprintf('CDEF:max_aggwrite%d=max_cleanwrite%d,max_aggwrite%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + #push @nodesTraffic, sprintf('CDEF:min_aggread%d=min_cleanread%d,min_aggread%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + #push @nodesTraffic, sprintf('CDEF:min_aggwrite%d=min_cleanwrite%d,min_aggwrite%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); + push @nodesTraffic, sprintf('CDEF:max_aggcapacity%d=max_cleancapacity%d,max_aggcapacity%d,+', $traf_item_counter, $traf_item_counter, $traf_item_counter-1); }; for my $thumb (0, 1) { @@ -272,104 +216,146 @@ for my $source (@SOURCES) { $body{$section} .= "
back"; $body{$section} .= '

'; }; -push @totalTraffic, sprintf('AREA:aggread%d#00FF00:Read bytes/s', $traf_item_counter); -push @totalTraffic, sprintf('LINE2:aggwrite%d#0000FF:Write bytes/s', $traf_item_counter); -push @totalTraffic, sprintf('LINE1:max_aggread%d#009A2C:Read [max 15min]', $traf_item_counter); -push @totalTraffic, sprintf('LINE1:max_aggwrite%d#5555FF:Write [max 15min]', $traf_item_counter); -#push @totalTraffic, sprintf('LINE1:min_aggread%d#FF76D4:Read [min]', $traf_item_counter); -#push @totalTraffic, sprintf('LINE1:min_aggwrite%d#222255:Write [min]', $traf_item_counter); -push @totalTraffic, sprintf('LINE1:max_aggcapacity%d#FF5555:Capacity', $traf_item_counter); -push @totalTraffic, sprintf('CDEF:zeroline=aggread%d,0,*', $traf_item_counter); -push @totalTraffic, sprintf('%s:%s' , 'LINE1' , 'zeroline' ); -my $html = "Number of Running Tor routers"; -$html .= "

Number of Running Tor routers

"; -$html .= "..
\n"; +sub makeTotalTrafficPic($$$) { + my ($file, $age, $include15min) = @_; + my @totalTraffic = (); + push @totalTraffic, $file; + push @totalTraffic, sprintf('-s %s', $NOW-$age); -if ($params[0] ne 'MAGIX1' || $params[1] ne 'MAGIX2') { - warn "params[0,1] aren't MAGIX1,2. not nice"; -} else { - $params[0] = $RESULT_DIR.'/totalWeekly.png'; - $params[1] = sprintf('-s %s', $NOW-7*24*3600); - my ($averages,$xsize,$ysize) = RRDs::graph @params; - warn RRDs::error if RRDs::error; + #push @totalTraffic, sprintf('-s %s', $START_AT); + push @totalTraffic, sprintf('-e %s', $END_AT); + #push @totalTraffic, sprintf('-e %s', $NOW- 2*24*3600); + push @totalTraffic, sprintf('-t %s', "Total Traffic"); + push @totalTraffic, sprintf('-aPNG'); + push @totalTraffic, sprintf('-v %s', "Bandwidth Used"); + #push @totalTraffic, sprintf('-w %d', 600); + #push @totalTraffic, sprintf('-h %d', 400); + push @totalTraffic, sprintf('-w %d', 497); + push @totalTraffic, sprintf('-h %d', 201); + #push @totalTraffic, sprintf('-h %d', 301); + #push @totalTraffic, sprintf('-h %d', 271); - $params[0] = $RESULT_DIR.'/totalBiWeekly.png'; - $params[1] = sprintf('-s %s', $NOW-14*24*3600); - ($averages,$xsize,$ysize) = RRDs::graph @params; - warn RRDs::error if RRDs::error; + push @totalTraffic, @nodesTraffic; - $params[0] = $RESULT_DIR.'/totalMonthly.png'; - $params[1] = sprintf('-s %s', $NOW-35*24*3600); - ($averages,$xsize,$ysize) = RRDs::graph @params; - warn RRDs::error if RRDs::error; - $params[0] = $RESULT_DIR.'/total.png'; - $params[1] = sprintf('-s %s', $START_AT); - ($averages,$xsize,$ysize) = RRDs::graph @params; - warn RRDs::error if RRDs::error; + push @totalTraffic, sprintf('AREA:aggread%d#00FF00:Read bytes/s', $traf_item_counter); + push @totalTraffic, sprintf('LINE2:aggwrite%d#0000FF:Write bytes/s', $traf_item_counter); + push @totalTraffic, sprintf('LINE1:max_aggread%d#009A2C:Read [max 15min]', $traf_item_counter) if $include15min; + push @totalTraffic, sprintf('LINE1:max_aggwrite%d#5555FF:Write [max 15min]', $traf_item_counter) if $include15min; + #push @totalTraffic, sprintf('LINE1:min_aggread%d#FF76D4:Read [min]', $traf_item_counter); + #push @totalTraffic, sprintf('LINE1:min_aggwrite%d#222255:Write [min]', $traf_item_counter); + push @totalTraffic, sprintf('LINE1:max_aggcapacity%d#FF5555:Capacity', $traf_item_counter); + + push @totalTraffic, sprintf('CDEF:zeroline=aggread%d,0,*', $traf_item_counter); + push @totalTraffic, sprintf('%s:%s' , 'LINE1' , 'zeroline' ); - $params[0] = $RESULT_DIR.'/total9Months.png'; - $params[1] = sprintf('-s %s', $NOW-9*30*24*3600); - ($averages,$xsize,$ysize) = RRDs::graph @params; + my ($averages,$xsize,$ysize) = RRDs::graph @totalTraffic; warn RRDs::error if RRDs::error; - $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

"; + return ($averages,$xsize,$ysize); }; +sub makeNumbersGraph($$) { + my ($file, $age) = @_; + + my @params; + push @params, $file; + push @params, sprintf('-s %s', $NOW-$age); + + push @params, sprintf('-e %s', $END_AT); + #push @params, sprintf('-e %s', $NOW- 2*24*3600); + push @params, sprintf('-t %s', "Running routers"); + push @params, sprintf('-aPNG'); + push @params, sprintf('-v %s', "# Routers"); + #push @params, sprintf('-w %d', 600); + #push @params, sprintf('-h %d', 400); + push @params, sprintf('-w %d', 497); + push @params, sprintf('-h %d', 301); + #push @params, sprintf('-h %d', 271); + + push @params, sprintf('DEF:%s=%s:%s:%s', 'd_runningVerified' , $RRD, 'runningVerified', 'AVERAGE'); + push @params, sprintf('CDEF:%s=%s' , 'c_runningVerified' , 'd_runningVerified'); + push @params, sprintf('DEF:%s=%s:%s:%s', 'd_runningUnverified' , $RRD, 'runningUnverified', 'AVERAGE'); + push @params, sprintf('CDEF:%s=%s' , 'c_runningUnverified' , 'd_runningUnverified'); + push @params, sprintf('DEF:%s=%s:%s:%s', 'd_exit80Verified' , $RRD, 'exit80Verified', 'AVERAGE'); + push @params, sprintf('CDEF:%s=%s' , 'c_exit80Verified' , 'd_exit80Verified'); + + push @params, sprintf('DEF:%s=%s:%s:%s', 'd_f_runningVerified' , $RRD, 'fastRunningVerified', 'AVERAGE'); + push @params, sprintf('CDEF:%s=%s' , 'c_f_runningVerified' , 'd_f_runningVerified'); + push @params, sprintf('DEF:%s=%s:%s:%s', 'd_f_runningUnverified' , $RRD, 'fastRunningUnverifi', 'AVERAGE'); + push @params, sprintf('CDEF:%s=%s' , 'c_f_runningUnverified' , 'd_f_runningUnverified'); + push @params, sprintf('DEF:%s=%s:%s:%s', 'd_f_exit80Verified' , $RRD, 'fastExit80Verified', 'AVERAGE'); + push @params, sprintf('CDEF:%s=%s' , 'c_f_exit80Verified' , 'd_f_exit80Verified'); + + #push @params, sprintf('%s:%s#%s:%s' , 'AREA' , 'c_runningVerified' , '7777FF', 'verified Nodes' ); + #push @params, sprintf('%s:%s#%s:%s' , 'STACK' , 'c_runningUnverified' , 'FF7700', 'unverified Nodes' ); + #push @params, sprintf('%s:%s#%s:%s' , 'LINE3' , 'c_exit80Verified' , '00FF00', 'verified Nodes exiting to port 80' ); + push @params, sprintf('%s:%s#%s:%s' , 'AREA' , 'c_runningVerified' , 'AAAAFF', 'verified Nodes' ); + push @params, sprintf('%s:%s#%s:%s' , 'STACK' , 'c_runningUnverified' , 'FF7700', '+unverified Nodes' ); + push @params, sprintf('%s:%s#%s:%s' , 'LINE2' , 'c_exit80Verified' , 'BBFFBB', 'verified Nodes exiting to port 80' ); + + push @params, sprintf('%s:%s#%s:%s' , 'LINE3' , 'c_f_runningVerified' , '0000FF', 'fast verified Nodes' ); + push @params, sprintf('%s:%s#%s:%s' , 'STACK' , 'c_f_runningUnverified' , 'FF0000', '+fast unverified Nodes' ); + push @params, sprintf('%s:%s#%s:%s' , 'LINE3' , 'c_f_exit80Verified' , '00FF00', 'fast verified Nodes exiting to port 80' ); + + push @params, sprintf('CDEF:%s=d_runningVerified,0,*,%s,+' , 'zeroline' , '0'); + push @params, sprintf('%s:%s' , 'LINE1' , 'zeroline' ); -if ($totalTraffic[0] ne 'MAGIX1' || $totalTraffic[1] ne 'MAGIX2') { - warn "totalTraffic[0,1] aren't MAGIX1,2. not nice"; -} else { - $totalTraffic[0] = $RESULT_DIR.'/totalTrafficWeekly.png'; - $totalTraffic[1] = sprintf('-s %s', $NOW-7*24*3600); - my ($averages,$xsize,$ysize) = RRDs::graph @totalTraffic; - warn RRDs::error if RRDs::error; - $totalTraffic[0] = $RESULT_DIR.'/totalTrafficBiWeekly.png'; - $totalTraffic[1] = sprintf('-s %s', $NOW-14*24*3600); - ($averages,$xsize,$ysize) = RRDs::graph @totalTraffic; - warn RRDs::error if RRDs::error; - $totalTraffic[0] = $RESULT_DIR.'/totalTrafficMonthly.png'; - $totalTraffic[1] = sprintf('-s %s', $NOW-35*24*3600); - ($averages,$xsize,$ysize) = RRDs::graph @totalTraffic; + my ($averages,$xsize,$ysize) = RRDs::graph @params; warn RRDs::error if RRDs::error; - $totalTraffic[0] = $RESULT_DIR.'/totalTraffic.png'; - $totalTraffic[1] = sprintf('-s %s', $START_AT); - ($averages,$xsize,$ysize) = RRDs::graph @totalTraffic; - warn RRDs::error if RRDs::error; + return ($averages,$xsize,$ysize); +}; - $totalTraffic[0] = $RESULT_DIR.'/totalTraffic9Months.png'; - $totalTraffic[1] = sprintf('-s %s', $NOW-9*30*24*3600); - ($averages,$xsize,$ysize) = RRDs::graph @totalTraffic; - warn RRDs::error if RRDs::error; +my $html = "Number of Running Tor routers"; +$html .= "

Number of Running Tor routers

"; +$html .= "..
\n"; + +my ($averages,$xsize,$ysize); + +makeNumbersGraph($RESULT_DIR.'/totalWeekly.png', 7*24*3600); +makeNumbersGraph($RESULT_DIR.'/totalBiWeekly.png', 14*24*3600); +makeNumbersGraph($RESULT_DIR.'/totalMonthly.png', 35*24*3600); +makeNumbersGraph($RESULT_DIR.'/totalLong.png', $LONG_TIME_MONTHS*30*24*3600); +($averages,$xsize,$ysize) = makeNumbersGraph($RESULT_DIR.'/total.png', $NOW - $START_AT); + +$html .= "

"; +$html .= "

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

\n"; +$html .= "

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

"; + + +makeTotalTrafficPic($RESULT_DIR.'/totalTrafficWeekly.png', 7*24*3600, 1); +makeTotalTrafficPic($RESULT_DIR.'/totalTrafficBiWeekly.png', 14*24*3600, 1); +makeTotalTrafficPic($RESULT_DIR.'/totalTrafficMonthly.png', 35*24*3600, 0); +makeTotalTrafficPic($RESULT_DIR.'/totalTrafficLong.png', $LONG_TIME_MONTHS*30*24*3600, 0); +($averages,$xsize,$ysize) = makeTotalTrafficPic($RESULT_DIR.'/totalTraffic.png', $NOW - $START_AT, 0); - $html .= "

"; - $html .= "

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

"; -} +$html .= "

"; +$html .= "

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

"; $html .= "

The directory is downloaded from "; - $html .= "http://tor.noreply.org:9030/"; + $html .= "http://tor.noreply.org/tor/"; $html .= " at regular intervals.
\n"; $html .= "Other directory sources are "; - $html .= "http://moria.mit.edu:9031/"; + $html .= "http://moria.mit.edu:9031/tor/"; $html .= " and\n"; - $html .= "http://moria.mit.edu:9032/"; + $html .= "http://belegost.mit.edu/tor/"; $html .= "."; $html .= "

Recent Nodes

"; @@ -414,12 +400,14 @@ close F; my %imgs = ( - total9Months => 'Number of routers over the last 9 months', + totalLong => 'Number of routers over the last '.$LONG_TIME_MONTHS.' 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', + totalWeekly => 'Number of routers over the last week', + totalTrafficLong => 'Traffic over the last '.$LONG_TIME_MONTHS.' months', totalTrafficMonthly => 'Traffic over the last month', - totalTrafficBiWeekly => 'Traffic over the last 2 weeks' ); + totalTrafficBiWeekly => 'Traffic over the last 2 weeks', + totalTrafficWeekly => 'Traffic over the last week' ); for my $key (keys %imgs) { open (F, ">$RESULT_DIR/$key.html") or die ("Cannot open $key.html: $!\n"); diff --git a/other/tor/bin/rrd-update b/other/tor/bin/rrd-update index 7151641..c7062f7 100755 --- a/other/tor/bin/rrd-update +++ b/other/tor/bin/rrd-update @@ -2,7 +2,6 @@ use strict; use RRDs; -use BER; use MIME::Base64; use Digest::SHA1 qw(sha1_hex); use Time::ParseDate; -- cgit v1.2.3