socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

Renamed gather() to update() in disk_mon.py

This commit is contained in:
David 2012-05-20 17:20:46 +02:00
parent f084e1303e
commit 326b4d70d5
1 changed files with 9 additions and 13 deletions

View File

@ -1,25 +1,21 @@
#!/usr/bin/python2
#
# disk monitor
#
#imports
import os
""" disk monitor """
class diskmon(object):
"""collect information about local partitions"""
def __init__(self):
self.gather()
self.update()
def gather(self):
"""gather the actual information"""
def update(self):
"""run collection of data"""
self.partitions = [] #information about all partitions (list of lists)
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
import os
self.partitions = []
uuids = os.listdir("/dev/disk/by-uuid")
for uuid in uuids:
part = {}
part["device"] = str("/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:])
part["uuid"] = uuid