import tuned.monitors import os class DiskMonitor(tuned.monitors.Monitor): _supported_vendors = ["ATA", "SCSI"] @classmethod def _init_available_devices(cls): block_devices = os.listdir("/sys/block") available = set(filter(cls._is_device_supported, block_devices)) cls._available_devices = available for d in available: cls._load[d] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] @classmethod def _is_device_supported(cls, device): vendor_file = "/sys/block/%s/device/vendor" % device try: vendor = open(vendor_file).read().strip() except IOError: return False return vendor in cls._supported_vendors @classmethod def update(cls): for device in cls._updating_devices: cls._update_disk(device) @classmethod def _update_disk(cls, dev): with open("/sys/block/" + dev + "/stat") as statfile: cls._load[dev] = list(map(int, statfile.read().split()))
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.__init__.pyo.40009 | File | 208 B | 0644 |
|
.monitor_disk.pyo.40009 | File | 1.89 KB | 0644 |
|
.monitor_load.pyo.40009 | File | 1.01 KB | 0644 |
|
.monitor_net.pyo.40009 | File | 1.96 KB | 0644 |
|
__init__.py | File | 46 B | 0644 |
|
__init__.pyc | File | 208 B | 0644 |
|
__init__.pyo | File | 208 B | 0644 |
|
base.py | File | 2.85 KB | 0644 |
|
base.pyc | File | 5.2 KB | 0644 |
|
base.pyo | File | 4.99 KB | 0644 |
|
monitor_disk.py | File | 886 B | 0644 |
|
monitor_disk.pyc | File | 1.89 KB | 0644 |
|
monitor_disk.pyo | File | 1.89 KB | 0644 |
|
monitor_load.py | File | 306 B | 0644 |
|
monitor_load.pyc | File | 1.01 KB | 0644 |
|
monitor_load.pyo | File | 1.01 KB | 0644 |
|
monitor_net.py | File | 1.14 KB | 0644 |
|
monitor_net.pyc | File | 1.96 KB | 0644 |
|
monitor_net.pyo | File | 1.96 KB | 0644 |
|
repository.py | File | 831 B | 0644 |
|
repository.pyc | File | 1.92 KB | 0644 |
|
repository.pyo | File | 1.86 KB | 0644 |
|