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

Re: gathering tor traffic stats



Max Berger wrote:
> I opened the control port in my torrc with "ControlPort 9051" and get my
> traffic stats with
> 
>  echo -en "authenticate\r\ngetinfo accounting/bytes\r\nquit\r\n" | \
>  nc localhost 9051
> 
> for more info about the control protocol have a look at
> http://tor.eff.org/svn/trunk/doc/spec/control-spec.txt

I added to torrc:

AccountingStart day 12:21
AccountingMax 999 TB

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

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]:  In:
LegendO[tor]:  Out:
TimeZone[tor]: Europe/Amsterdam
Title[tor]: tor traffic
PageTop[tor]: <H2>Tor traffic</H2>
######################################################################

Tips, fixes, etc are welcome!