def collect_disk_usage(self, whitelist=[]):
        for partition in psutil.disk_partitions():
            if not whitelist or partition.mountpoint in whitelist or partition.device in whitelist:
                usage = psutil.disk_usage(partition.mountpoint)
                if platform.system() == "Windows":
                    disk_name = "-" + \
                        partition.mountpoint.replace("\\", "").replace(":", "")
                else:
                    disk_name = partition.mountpoint.replace("/", "-")
                    if disk_name == "-":
                        disk_name = "-root"
                self.registry.gauge("df%s.total" % disk_name).set_value(usage.total)
                self.registry.gauge("df%s.used" % disk_name).set_value(usage.used)
                self.registry.gauge("df%s.free" % disk_name).set_value(usage.free)
dataset/ETHPy150Open omergertel/pyformance/example_sysmetrics.py/Collector.collect_disk_usage/original