def _disk(self):
        """Record Disk usage."""
        mountpoints = [
            p.mountpoint for p in psutil.disk_partitions()
            if p.device.endswith(self.device)
        ]
        if len(mountpoints) != 1:
            raise CommandError("Unknown device: {0}".format(self.device))

        value = int(psutil.disk_usage(mountpoints[0]).percent)
        set_metric("disk-{0}".format(self.device), value, category=self.category)
        gauge("disk-{0}".format(self.device), value)
    def _disk(self):
        """Record Disk usage."""
        mountpoints = [
            p.mountpoint for p in psutil.disk_partitions()
            if p.device.endswith(self.device)
        ]
        if len(mountpoints) != 1:
            raise CommandError("Unknown device: {0}".format(self.device))

        value = int(psutil.disk_usage(mountpoints[0]).percent)
        set_metric("disk-{0}".format(self.device),
                   value,
                   category=self.category)
        gauge("disk-{0}".format(self.device), value)
 def _mem(self):
     """Record Memory usage."""
     value = int(psutil.virtual_memory().percent)
     set_metric("memory", value, category=self.category)
     gauge("memory", value)
 def _cpu(self):
     """Record CPU usage."""
     value = int(psutil.cpu_percent())
     set_metric("cpu", value, category=self.category)
     gauge("cpu", value)
 def _mem(self):
     """Record Memory usage."""
     value = int(psutil.virtual_memory().percent)
     set_metric("memory", value, category=self.category)
     gauge("memory", value)
 def _cpu(self):
     """Record CPU usage."""
     value = int(psutil.cpu_percent())
     set_metric("cpu", value, category=self.category)
     gauge("cpu", value)