From b25446d514a940ea87597cc05c5d803a5c815fe1 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 9 Aug 2007 18:26:57 -0700 Subject: [PATCH] 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. --- misc/munin/tahoe-storagespace.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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) -- 2.45.2