mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
add some munin plugins
This commit is contained in:
parent
c15f37dc9b
commit
8b2f0ef44c
38
misc/munin/tahoe-dirnodes.py
Normal file
38
misc/munin/tahoe-dirnodes.py
Normal file
@ -0,0 +1,38 @@
|
||||
#! /usr/bin/python
|
||||
|
||||
# This is a munin plugin to track the number of directory nodes that a vdrive
|
||||
# server is maintaining on behalf of other nodes. If a mesh has only one
|
||||
# vdrive server (or if clients are only bothering to use a single one), then
|
||||
# this will be equal to the number of dirnodes in use in the entire mesh.
|
||||
|
||||
# Copy this plugin into /etc/munun/plugins/tahoe-dirnodes and then put
|
||||
# the following in your /etc/munin/plugin-conf.d/foo file to let it know
|
||||
# where to find the basedirectory for the vdrive server.
|
||||
#
|
||||
# [tahoe-storagespace]
|
||||
# env.basedir /path/to/vdrivenode
|
||||
|
||||
import os, sys
|
||||
|
||||
nodedir = os.environ["basedir"]
|
||||
|
||||
configinfo = \
|
||||
"""graph_title Allmydata Tahoe Dirnode Count
|
||||
graph_vlabel bytes
|
||||
graph_category tahoe
|
||||
graph_info This graph shows the number of directory nodes hosted by this vdrive server
|
||||
dirnodes.label dirnodes
|
||||
dirnodes.draw LINE2
|
||||
"""
|
||||
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "config":
|
||||
print configinfo
|
||||
sys.exit(0)
|
||||
|
||||
dirnodes = len(os.listdir(os.path.join(nodedir, "vdrive")))
|
||||
if os.path.exists(os.path.join(nodedir, "vdrive", "root")):
|
||||
dirnodes -= 1 # the 'root' pointer doesn't count
|
||||
print "dirnodes.value %d" % dirnodes
|
||||
|
51
misc/munin/tahoe-files.py
Normal file
51
misc/munin/tahoe-files.py
Normal file
@ -0,0 +1,51 @@
|
||||
#! /usr/bin/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-storagespace]
|
||||
# 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 bytes
|
||||
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
|
||||
sys.exit(0)
|
||||
|
||||
for nodename, basedir in nodedirs:
|
||||
files = len(os.listdir(os.path.join(basedir, "storage")))
|
||||
if os.path.exists(os.path.join(basedir, "storage", "incoming")):
|
||||
files -= 1 # the 'incoming' directory doesn't count
|
||||
print "%s.value %d" % (nodename, files)
|
||||
|
60
misc/munin/tahoe-sharesperfile.py
Normal file
60
misc/munin/tahoe-sharesperfile.py
Normal file
@ -0,0 +1,60 @@
|
||||
#! /usr/bin/python
|
||||
|
||||
# This is a munin plugin to track the average number of shares per file in
|
||||
# each node's StorageServer. If this number is 100, that suggests there is
|
||||
# only a single node in the entire mesh. If the number is 2, that suggests
|
||||
# that there are 50 nodes in the entire mesh. If the number is 1, that
|
||||
# suggests that there are >= 100 nodes in the entire mesh. (if there were a
|
||||
# million nodes, this one node would only see a single share per file, so the
|
||||
# number of shares-per-file will never be less than 1).
|
||||
|
||||
# Copy this plugin into /etc/munun/plugins/tahoe-sharesperfile 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-sharesperfile]
|
||||
# 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 Shares Per File
|
||||
graph_vlabel shares per file
|
||||
graph_category tahoe
|
||||
graph_info This graph shows the number of shares present for each file 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
|
||||
sys.exit(0)
|
||||
|
||||
for nodename, basedir in nodedirs:
|
||||
files = 0
|
||||
shares = 0
|
||||
for f in os.listdir(os.path.join(basedir, "storage")):
|
||||
if f == "incoming":
|
||||
continue
|
||||
files += 1
|
||||
filedir = os.path.join(basedir, "storage", f)
|
||||
shares += len(os.listdir(filedir))
|
||||
if files:
|
||||
shares_per_file = 1.0 * shares / files
|
||||
else:
|
||||
shares_per_file = 0.0
|
||||
print "%s.value %d" % (nodename, shares_per_file)
|
||||
|
53
misc/munin/tahoe-storagespace.py
Normal file
53
misc/munin/tahoe-storagespace.py
Normal file
@ -0,0 +1,53 @@
|
||||
#! /usr/bin/python
|
||||
|
||||
# This is a munin plugin to track the amount of disk space each node's
|
||||
# StorageServer is consuming on behalf of other nodes. This is where the
|
||||
# shares are kept. If there are N nodes present in the mesh, the total space
|
||||
# consumed by the entire mesh will be about N times the space reported by
|
||||
# this plugin.
|
||||
|
||||
# Copy this plugin into /etc/munun/plugins/tahoe-storagespace 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-storagespace]
|
||||
# env.basedir_NODE1 /path/to/node1
|
||||
# env.basedir_NODE2 /path/to/node2
|
||||
# env.basedir_NODE3 /path/to/node3
|
||||
#
|
||||
# Allmydata-tahoe must be installed on the system where this plugin is used,
|
||||
# since it imports a utility module from allmydata.utils .
|
||||
|
||||
import os, sys
|
||||
|
||||
from allmydata.util import fileutil
|
||||
|
||||
nodedirs = []
|
||||
for k,v in os.environ.items():
|
||||
if k.startswith("basedir_"):
|
||||
nodename = k[len("basedir_"):]
|
||||
nodedirs.append( (nodename, v) )
|
||||
nodedirs.sort()
|
||||
|
||||
seriesname = "storage"
|
||||
|
||||
configinfo = \
|
||||
"""graph_title Allmydata Tahoe Shareholder Space
|
||||
graph_vlabel bytes
|
||||
graph_category tahoe
|
||||
graph_info This graph shows the space consumed 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
|
||||
sys.exit(0)
|
||||
|
||||
for nodename, basedir in nodedirs:
|
||||
usage = fileutil.du(os.path.join(basedir, "storage"))
|
||||
print "%s.value %d" % (nodename, usage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user