Munin plugins for Tor

Peter Palfrader peter at palfrader.org
Fri Jun 2 01:16:13 UTC 2006


On Thu, 01 Jun 2006, Ge van Geldorp wrote:

> I have written two plugins for Munin http://munin.projects.linpro.no. Munin
> is a tool to monitor your *nix machines and the plugins allow you to include
> Tor in your monitoring. The plugins can be found here:
> 
> http://munin.projects.linpro.no/wiki/plugin-tor_connections (shows the
> number of or-connections)

I found it easier to just check the number of file descriptors that Tor
is using:

#!/usr/bin/perl -w

use strict;

# Script to monitor the amount of FDs used by
# the Tor process (var/run/tor/tor.pid)

if ($ARGV[0] and $ARGV[0] =~ /^\s*config\s*$/i)
{
	print "graph_title Open file descriptors for Tor\n";
	print "graph_args --base 1000 -l 0\n";
	print "graph_vlabel open FDs\n";
	print "graph_category network\n";
	print "count.label TorFDs\n";
	exit 0;
}

open (PID, "/var/run/tor/tor.pid") or exit 1;
my $pid = <PID>;
close PID;
chomp $pid;

$pid =~ /^[0-9]+$/ or exit 1;

opendir (FDS, "/proc/$pid/fd") or exit 1;
my @fds = readdir(FDS);
closedir FDS;

my $count = scalar @fds - 2;

print "count.value $count\n";

> http://munin.projects.linpro.no/wiki/plugin-tor_traffic (shows the
> amounttraffic flowing through your node)

Instead of doing SETEVENTS bw and only getting a snapshow of the traffic
I gave tor its own IP address and use the ip_ plugin now, which uses
netfilter.  This is probably the better option if available to you.

Cheers,
Peter
-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/



More information about the tor-talk mailing list