system info fixes (#212)

This commit is contained in:
David Brazda
2024-06-20 22:27:28 +02:00
committed by GitHub
parent 0bda14409d
commit 2f15b0b2a7
2 changed files with 23 additions and 20 deletions

View File

@ -1033,17 +1033,18 @@ def get_system_info():
disk_used = round(psutil.disk_usage('/').used / 1024**3, 1)
disk_free = round(psutil.disk_usage('/').free / 1024**3, 1)
disk_used_percentage = round(psutil.disk_usage('/').percent, 1)
memory_total = round(psutil.virtual_memory().total / 1024**3, 1)
memory_perc = round(psutil.virtual_memory().percent, 1)
cpu_time_user = round(psutil.cpu_times().user,1)
cpu_time_system = round(psutil.cpu_times().system,1)
cpu_time_idle = round(psutil.cpu_times().idle,1)
network_sent = round(psutil.net_io_counters().bytes_sent / 1024**3, 6)
network_recv = round(psutil.net_io_counters().bytes_recv / 1024**3, 6)
# memory_total = round(psutil.virtual_memory().total / 1024**3, 1)
# memory_perc = round(psutil.virtual_memory().percent, 1)
# cpu_time_user = round(psutil.cpu_times().user,1)
# cpu_time_system = round(psutil.cpu_times().system,1)
# cpu_time_idle = round(psutil.cpu_times().idle,1)
# network_sent = round(psutil.net_io_counters().bytes_sent / 1024**3, 6)
# network_recv = round(psutil.net_io_counters().bytes_recv / 1024**3, 6)
return {"disk_space": {"total": disk_total, "used": disk_used, "free" : disk_free, "used_percentage" : disk_used_percentage},
"memory": {"total": memory_total, "used_percentage": memory_perc},
"cpu_time" : {"user": cpu_time_user, "system": cpu_time_system, "idle": cpu_time_idle},
"network": {"sent": network_sent, "received": network_recv}}
# "memory": {"total": memory_total, "used_percentage": memory_perc},
# "cpu_time" : {"user": cpu_time_user, "system": cpu_time_system, "idle": cpu_time_idle},
# "network": {"sent": network_sent, "received": network_recv}
}
# Thread function to insert data from the queue into the database
def insert_queue2db():

View File

@ -136,18 +136,20 @@
<body>
<div id="main" class="mainConteiner flex-container content">
<div id="system-info" class="flex-items">
<label data-bs-toggle="collapse" data-bs-target="#disk-gauge-container" aria-expanded="true">
<label data-bs-toggle="collapse" data-bs-target="#system-info-inner" aria-expanded="true">
<h4>System Info </h4>
</label>
<div id="system-info-output"> </div>
<div id="graphical-output">
<div id="disk-gauge-container">
<span id="title"> Disk Space: </span>
<span id="free-space">Free: -- GB</span> |
<span id="total-space">Total: -- GB</span> |
<span id="used-percent">Used: -- %</span>
<div id="disk-gauge">
<div id="disk-gauge-bar"></div>
<div id="system-info-inner" class="collapse">
<div id="system-info-output"></div>
<div id="graphical-output">
<div id="disk-gauge-container">
<span id="title"> Disk Space: </span>
<span id="free-space">Free: -- GB</span> |
<span id="total-space">Total: -- GB</span> |
<span id="used-percent">Used: -- %</span>
<div id="disk-gauge">
<div id="disk-gauge-bar"></div>
</div>
</div>
</div>
</div>