p
This commit is contained in:
parent
1d19a718bc
commit
00357793e1
|
@ -24,17 +24,6 @@ class SystemInfoModule(BaseModule):
|
||||||
mem = psutil.virtual_memory()
|
mem = psutil.virtual_memory()
|
||||||
mem_used = round(mem.used / (1024 * 1024))
|
mem_used = round(mem.used / (1024 * 1024))
|
||||||
mem_total = round(mem.total / (1024 * 1024))
|
mem_total = round(mem.total / (1024 * 1024))
|
||||||
lines.append(f"Mem: {mem_used}/{mem_total}MB")
|
lines.append(f"Mem: {mem_used}/{mem_total}MB ({mem.percent}%)")
|
||||||
|
|
||||||
# IP address
|
|
||||||
ip_address = "No IP"
|
|
||||||
for interface, addrs in psutil.net_if_addrs().items():
|
|
||||||
for addr in addrs:
|
|
||||||
if addr.family == 2 and not addr.address.startswith("127."):
|
|
||||||
ip_address = addr.address
|
|
||||||
break
|
|
||||||
if ip_address != "No IP":
|
|
||||||
break
|
|
||||||
lines.append(f"IP: {ip_address}")
|
|
||||||
|
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
Loading…
Reference in a new issue