import os import psutil class HDD: interval = 10; loopCount = 0 def __init__(self, exporter): self.exporter = exporter def run(self): discs = psutil.disk_partitions() for disc in discs: name = disc.device.split("/")[-1] usage = psutil.disk_usage(disc.mountpoint) self.exporter.gauge("hdd."+name+".total", usage.total) self.exporter.gauge("hdd."+name+".used", usage.used) self.exporter.gauge("hdd."+name+".free", usage.free) self.exporter.gauge("hdd."+name+".percent", usage.percent)