/usr/share/munin/plugins/tahoe_files is in tahoe-lafs 1.10.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/usr/bin/env python
# This is a munin plugin to track the number of files that each node's
# StorageServer is holding on behalf of other nodes. Each file that has been
# uploaded to the mesh (and has shares present on this node) will be counted
# here. When there are <= 100 nodes in the mesh, this count will equal the
# total number of files that are active in the entire mesh. When there are
# 200 nodes present in the mesh, it will represent about half of the total
# number.
# Copy this plugin into /etc/munun/plugins/tahoe-files and then put
# the following in your /etc/munin/plugin-conf.d/foo file to let it know
# where to find the basedirectory for each node:
#
# [tahoe-files]
# env.basedir_NODE1 /path/to/node1
# env.basedir_NODE2 /path/to/node2
# env.basedir_NODE3 /path/to/node3
#
import os, sys
nodedirs = []
for k,v in os.environ.items():
if k.startswith("basedir_"):
nodename = k[len("basedir_"):]
nodedirs.append( (nodename, v) )
nodedirs.sort()
configinfo = \
"""graph_title Allmydata Tahoe Filecount
graph_vlabel files
graph_category tahoe
graph_info This graph shows the number of files hosted by this node's StorageServer
"""
for nodename, basedir in nodedirs:
configinfo += "%s.label %s\n" % (nodename, nodename)
configinfo += "%s.draw LINE2\n" % (nodename,)
if len(sys.argv) > 1:
if sys.argv[1] == "config":
print configinfo.rstrip()
sys.exit(0)
for nodename, basedir in nodedirs:
shares = 0
root = os.path.join(basedir, "storage", "shares")
for dirpath, dirnames, filenames in os.walk(root, topdown=True):
if dirpath == root and "incoming" in dirnames:
dirnames.remove("incoming")
shares += len(filenames)
print "%s.value %d" % (nodename, shares)
|