Renamed gather() to update() in disk_mon.py
This commit is contained in:
parent
f084e1303e
commit
326b4d70d5
22
disk_mon.py
22
disk_mon.py
|
@ -1,25 +1,21 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python2
|
||||||
|
|
||||||
#
|
""" disk monitor """
|
||||||
# disk monitor
|
|
||||||
#
|
|
||||||
|
|
||||||
#imports
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class diskmon(object):
|
class diskmon(object):
|
||||||
"""collect information about local partitions"""
|
"""collect information about local partitions"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.gather()
|
self.update()
|
||||||
|
|
||||||
def gather(self):
|
def update(self):
|
||||||
"""gather the actual information"""
|
"""run collection of data"""
|
||||||
|
|
||||||
self.partitions = [] #information about all partitions (list of lists)
|
import os
|
||||||
uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
|
|
||||||
for uuid in uuids: #write /dev/names as keys and uuids as values in the dictionary
|
self.partitions = []
|
||||||
|
uuids = os.listdir("/dev/disk/by-uuid")
|
||||||
|
for uuid in uuids:
|
||||||
part = {}
|
part = {}
|
||||||
part["device"] = str("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
|
part["device"] = str("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
|
||||||
part["uuid"] = uuid
|
part["uuid"] = uuid
|
||||||
|
|
Reference in New Issue