From: Brian Warner Date: Fri, 10 Aug 2007 01:26:57 +0000 (-0700) Subject: munin/tahoe-storagespace.py: use /bin/du instead of our python version, since X-Git-Tag: allmydata-tahoe-0.5.0~99 X-Git-Url: https://git.rkrishnan.org/pf/content/it.html?a=commitdiff_plain;h=b25446d514a940ea87597cc05c5d803a5c815fe1;p=tahoe-lafs%2Ftahoe-lafs.git munin/tahoe-storagespace.py: use /bin/du instead of our python version, since it a) is faster and b) will include filesystem overhead that is a real cost. --- diff --git a/misc/munin/tahoe-storagespace.py b/misc/munin/tahoe-storagespace.py index 02cccbb0..87339292 100644 --- a/misc/munin/tahoe-storagespace.py +++ b/misc/munin/tahoe-storagespace.py @@ -19,8 +19,7 @@ # since it imports a utility module from allmydata.utils . import os, sys - -from allmydata.util import fileutil +import commands nodedirs = [] for k,v in os.environ.items(): @@ -48,6 +47,11 @@ if len(sys.argv) > 1: sys.exit(0) for nodename, basedir in nodedirs: - usage = fileutil.du(os.path.join(basedir, "storage")) + cmd = "du --bytes --summarize %s" % os.path.join(basedir, "storage") + rc,out = commands.getstatusoutput(cmd) + if rc != 0: + sys.exit(rc) + bytes, extra = out.split() + usage = int(bytes) print "%s.value %d" % (nodename, usage)