Display total disk usage info in swift-recon
Now display's cluster disk space used, free, and total. Change-Id: I9c48dd6badaecd64cda4a2a8a51f41f1c29d328a
This commit is contained in:
parent
14fbbab0f1
commit
83a12ece2a
|
@ -331,6 +331,8 @@ class SwiftRecon(object):
|
|||
stats = {}
|
||||
highs = []
|
||||
lows = []
|
||||
raw_total_used = []
|
||||
raw_total_avail = []
|
||||
averages = []
|
||||
percents = {}
|
||||
recon = Scout("diskusage", self.verbose, self.suppress_errors,
|
||||
|
@ -344,6 +346,8 @@ class SwiftRecon(object):
|
|||
if entry['mounted']:
|
||||
used = float(entry['used']) / float(entry['size']) \
|
||||
* 100.0
|
||||
raw_total_used.append(entry['used'])
|
||||
raw_total_avail.append(entry['avail'])
|
||||
hostusage.append(round(used, 2))
|
||||
stats[url] = hostusage
|
||||
|
||||
|
@ -372,6 +376,11 @@ class SwiftRecon(object):
|
|||
for percent in sorted(percents):
|
||||
print '% 3d%%%5d %s' % (percent, percents[percent], \
|
||||
'*' * int(percents[percent] * mul))
|
||||
raw_used = sum(raw_total_used)
|
||||
raw_avail = sum(raw_total_avail)
|
||||
raw_total = raw_used + raw_avail
|
||||
print "Disk usage: space used: %s of %s" % (raw_used, raw_total)
|
||||
print "Disk usage: space free: %s of %s" % (raw_avail, raw_total)
|
||||
print "Disk usage: lowest: %s%%, highest: %s%%, avg: %s%%" % \
|
||||
(low, high, average)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue