working display for monitor/disk.py, working monitor/disk.py, starting new branch for heavy testing
This commit is contained in:
parent
c2dd867ae3
commit
27b90c35dc
|
@ -21,17 +21,16 @@ def blocks2bytes(blocks, blocksize):
|
|||
if __name__ == "__main__":
|
||||
diskmoninstance = disk.diskmon()
|
||||
for partition in diskmoninstance.partitions:
|
||||
print "Device:\t\t" + str(partition["device"]) + \
|
||||
"\nUUID:\t\t" + str(partition["uuid"])
|
||||
print "Device:\t\t" + str(partition["device"])
|
||||
print "UUID:\t\t" + str(partition["uuid"])
|
||||
if partition.has_key("mountpoint"):
|
||||
totalbytes = blocks2bytes(partition["total blocks"], partition["blocksize"])
|
||||
totalhuman = bytes2human(totalbytes)
|
||||
freebytes = blocks2bytes(partition["free blocks"], partition["blocksize"])
|
||||
freehuman = bytes2human(freebytes)
|
||||
percent = 100.00 * freebytes / totalbytes
|
||||
print "Mountpoint:\t" + str(partition["mountpoint"]) + \
|
||||
"\nFilesystem:\t" + str(partition["filesystem"]) + \
|
||||
"\nUsage:\t\t%.2f%s/%.2f%s(%i)\n" %(freehuman[0], freehuman[1], totalhuman[0], totalhuman[1], percent)
|
||||
"\nUsage:\t\t%.2f%s/%.2f%s\n" %(freehuman[0], freehuman[1], totalhuman[0], totalhuman[1])
|
||||
else:
|
||||
print "\n"
|
||||
|
||||
|
|
Reference in New Issue