[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gathering tor traffic stats



Am Montag, den 12.02.2007, 19:00 +0100 schrieb Udo van den Heuvel:
> 
> I added to torrc:
> 
> AccountingStart day 12:21
> AccountingMax 999 TB

>  (does it help to switch to month accounting w.r.t. counter resets?)

my Max is about 1GB/day. So my server i going hibernating after half a
day and gets a reset every day.

mrtg ist not very sensitive to counter resets, maybe you will loose the
traffic of 5 minutes, but that's all.

I use a script in /usr/local/mrtg/tor
------------
#!/bin/bash
 echo -en "authenticate\r\ngetinfo accounting/bytes\r\nquit\r\n" | \
      nc localhost 9051 | grep acc|\
      awk '{gsub("250-accounting/bytes=","");print $1; print $2}'
 /usr/bin/uptime | awk '{ gsub(",","");print $3, $4, $5 }'
 echo "dianacht.de"
-------------

and in my mrtg.cfg
-------------
Target[tor]:   `/usr/local/mrtg/tor`
Title[tor]:    Tor
PageTop[tor]:  <center><h2>Tor Traffic</h2></center>
Options[tor]:  growright, avgpeak
MaxBytes[tor]: 12500000
kilo[tor]:     1024
------------

looks very similar to your solution, my script creates this output:
http://test.dianacht.de/mrtg/tor.html (looking like a sawtooth because
of daily hibernating periods)

There is a little gap between the "real" traffic generated by tor and
the measured traffic (about 5-10% more "real" traffic). I think because
accounting does not count the TLS overhead. This is fixed in
0.1.2.5-alpha, as I read...

Max

> 
> And put in mrtg.cfg:
> 
> ######################################################################
> #                                                                    #
> # this is the tor traffic                                            #
> #                                                                    #
> ######################################################################
> Target[tor]: `/bin/echo -en "authenticate\r\ngetinfo
> accounting/bytes\r\nquit\r\n" |/usr/bin/nc localhost 9051|/bin/awk
> '/250-accounting.bytes=/ {split($1, a, "="); print a[2]; print $2}'`
> Options[tor]: noinfo, growright, transparent, nopercent
> MaxBytes[tor]: 1250000
> AbsMax[tor]: 1250000
> kilo[tor]: 1024
> YLegend[tor]: Bytes per second
> ShortLegend[tor]: B/s
> Legend1[tor]: Incoming Traffic in Bytes per second
> Legend2[tor]: Outgoing Traffic in Bytes per second
> Legend3[tor]: Maximal 10 Minute Incoming Traffic
> Legend4[tor]: Maximal 10 Minute Outgoing Traffic
> LegendI[tor]: &nbsp;In:
> LegendO[tor]: &nbsp;Out:
> TimeZone[tor]: Europe/Amsterdam
> Title[tor]: tor traffic
> PageTop[tor]: <H2>Tor traffic</H2>