munin: update shareholder plugins to match current storage layout

This commit is contained in:
Brian Warner 2007-10-18 12:08:58 -07:00
parent c6bbe74f59
commit 33a02e19f1
2 changed files with 4 additions and 4 deletions

View File

@ -44,8 +44,8 @@ if len(sys.argv) > 1:
sys.exit(0) sys.exit(0)
for nodename, basedir in nodedirs: for nodename, basedir in nodedirs:
files = len(os.listdir(os.path.join(basedir, "storage"))) files = len(os.listdir(os.path.join(basedir, "storage", "shares")))
if os.path.exists(os.path.join(basedir, "storage", "incoming")): if os.path.exists(os.path.join(basedir, "storage", "shares", "incoming")):
files -= 1 # the 'incoming' directory doesn't count files -= 1 # the 'incoming' directory doesn't count
print "%s.value %d" % (nodename, files) print "%s.value %d" % (nodename, files)

View File

@ -46,11 +46,11 @@ if len(sys.argv) > 1:
for nodename, basedir in nodedirs: for nodename, basedir in nodedirs:
files = 0 files = 0
shares = 0 shares = 0
for f in os.listdir(os.path.join(basedir, "storage")): for f in os.listdir(os.path.join(basedir, "storage", "shares")):
if f == "incoming": if f == "incoming":
continue continue
files += 1 files += 1
filedir = os.path.join(basedir, "storage", f) filedir = os.path.join(basedir, "storage", "shares", f)
shares += len(os.listdir(filedir)) shares += len(os.listdir(filedir))
if files: if files:
shares_per_file = 1.0 * shares / files shares_per_file = 1.0 * shares / files