Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / network / tor_traffic @ 942bda31

Historique | Voir | Annoter | Télécharger (654 octets)

1
#!/bin/sh
2
#
3
# (c)2010 lists@nerdbynature.de
4
#
5
# Get accounting information from a running Tor server.
6
#
7

    
8

    
9
COOKIE=/opt/tor/.tor/control_auth_cookie
10
PORT=9051
11

    
12

    
13
if [ "$1" = config ]; then
14
	echo "graph_title Tor Traffic"
15
	echo "graph_args --base 1000"
16
	echo "graph_vlabel bytes in / out"
17
	echo "graph_category network"
18
	echo "down.label Download"
19
        echo "down.type GAUGE"
20
        echo "up.label Upload"
21
	echo "up.type GAUGE"
22
	exit 0
23
fi
24

    
25
/bin/echo -e "AUTHENTICATE \"`cat $COOKIE`\"\nGETINFO accounting/bytes\nQUIT" | nc localhost $PORT | \
26
	awk -F= '/accounting\/bytes/ {print $2}' | \
27
	tr -d '\015' | \
28
	awk '{print "down.value "$1 "\nup.value "$2}'