3 # This is a munin plugin to track the number of files that each node's
4 # StorageServer is holding on behalf of other nodes. Each file that has been
5 # uploaded to the mesh (and has shares present on this node) will be counted
6 # here. When there are <= 100 nodes in the mesh, this count will equal the
7 # total number of files that are active in the entire mesh. When there are
8 # 200 nodes present in the mesh, it will represent about half of the total
11 # Copy this plugin into /etc/munun/plugins/tahoe-files and then put
12 # the following in your /etc/munin/plugin-conf.d/foo file to let it know
13 # where to find the basedirectory for each node:
16 # env.basedir_NODE1 /path/to/node1
17 # env.basedir_NODE2 /path/to/node2
18 # env.basedir_NODE3 /path/to/node3
24 for k,v in os.environ.items():
25 if k.startswith("basedir_"):
26 nodename = k[len("basedir_"):]
27 nodedirs.append( (nodename, v) )
31 """graph_title Allmydata Tahoe Filecount
34 graph_info This graph shows the number of files hosted by this node's StorageServer
37 for nodename, basedir in nodedirs:
38 configinfo += "%s.label %s\n" % (nodename, nodename)
39 configinfo += "%s.draw LINE2\n" % (nodename,)
43 if sys.argv[1] == "config":
44 print configinfo.rstrip()
47 for nodename, basedir in nodedirs:
49 root = os.path.join(basedir, "storage", "shares")
51 for dirpath, dirnames, filenames in os.walk(root, topdown=True):
52 if dirpath == root and "incoming" in dirnames:
53 dirnames.remove("incoming")
54 shares += len(filenames)
55 print "%s.value %d" % (nodename, shares)