Commit e10b401d by Bach Dániel

add disk usage reporting

parent e704eb93
...@@ -133,10 +133,14 @@ class SerialLineReceiver(SerialLineReceiverBase): ...@@ -133,10 +133,14 @@ class SerialLineReceiver(SerialLineReceiverBase):
self.lc.start(5, now=False) self.lc.start(5, now=False)
def send_status(self): def send_status(self):
disk_usage = {(disk.device.replace('/', '_')):
psutil.disk_usage(disk.mountpoint).percent
for disk in psutil.disk_partitions()}
args = {"cpu": dict(psutil.cpu_times().__dict__), args = {"cpu": dict(psutil.cpu_times().__dict__),
"ram": dict(psutil.virtual_memory().__dict__), "ram": dict(psutil.virtual_memory().__dict__),
"swap": dict(psutil.swap_memory().__dict__), "swap": dict(psutil.swap_memory().__dict__),
"uptime": {"seconds": uptime.uptime()}, "uptime": {"seconds": uptime.uptime()},
"disk": disk_usage,
"user": {"count": len(psutil.get_users())}} "user": {"count": len(psutil.get_users())}}
self.send_response(response='status', self.send_response(response='status',
args=args) args=args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment