3 # This is a munin plugin to track the amount of disk space each node's
4 # StorageServer is consuming on behalf of other nodes. This is where the
5 # shares are kept. If there are N nodes present in the mesh, the total space
6 # consumed by the entire mesh will be about N times the space reported by
9 # Copy this plugin into /etc/munun/plugins/tahoe_storagespace and then put
10 # the following in your /etc/munin/plugin-conf.d/foo file to let it know
11 # where to find the basedirectory for each node:
13 # [tahoe_storagespace]
14 # env.basedir_NODE1 /path/to/node1
15 # env.basedir_NODE2 /path/to/node2
16 # env.basedir_NODE3 /path/to/node3
18 # Allmydata-tahoe must be installed on the system where this plugin is used,
19 # since it imports a utility module from allmydata.utils .
25 for k,v in os.environ.items():
26 if k.startswith("basedir_"):
27 nodename = k[len("basedir_"):]
28 nodedirs.append( (nodename, v) )
31 seriesname = "storage"
34 """graph_title Allmydata Tahoe Shareholder Space
37 graph_info This graph shows the space consumed by this node's StorageServer
40 for nodename, basedir in nodedirs:
41 configinfo += "%s.label %s\n" % (nodename, nodename)
42 configinfo += "%s.draw LINE2\n" % (nodename,)
46 if sys.argv[1] == "config":
47 print configinfo.rstrip()
50 for nodename, basedir in nodedirs:
51 cmd = "du --bytes --summarize %s" % os.path.join(basedir, "storage")
52 rc,out = commands.getstatusoutput(cmd)
55 bytes, extra = out.split()
57 print "%s.value %d" % (nodename, usage)