Relocate baseline config to administration subtabs, refine nav row, and add live CPU and RAM reporting
CI Test Suite / Run Component Tests & Pipeline Verification (push) Successful in 2m12s
CI Test Suite / Run Component Tests & Pipeline Verification (push) Successful in 2m12s
This commit is contained in:
@@ -436,6 +436,7 @@ def get_full_system_inventory() -> Dict[str, Any]:
|
||||
|
||||
# Memory
|
||||
mem_total_mb = 0
|
||||
mem_percent = 0.0
|
||||
try:
|
||||
if sys.platform == "win32":
|
||||
import ctypes
|
||||
@@ -455,12 +456,19 @@ def get_full_system_inventory() -> Dict[str, Any]:
|
||||
stat.dwLength = ctypes.sizeof(MEMORYSTATUSEX)
|
||||
if ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)):
|
||||
mem_total_mb = int(stat.ullTotalPhys / (1024 * 1024))
|
||||
mem_percent = float(stat.dwMemoryLoad)
|
||||
elif os.path.exists("/proc/meminfo"):
|
||||
tot = 0
|
||||
avail = 0
|
||||
with open("/proc/meminfo", "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
if line.startswith("MemTotal:"):
|
||||
mem_total_mb = int(line.split(":")[1].strip().split()[0]) // 1024
|
||||
break
|
||||
tot = int(line.split(":")[1].strip().split()[0])
|
||||
elif line.startswith(("MemAvailable:", "MemFree:")) and avail == 0:
|
||||
avail = int(line.split(":")[1].strip().split()[0])
|
||||
if tot > 0:
|
||||
mem_total_mb = tot // 1024
|
||||
mem_percent = round(((tot - avail) / tot) * 100, 1)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -478,6 +486,7 @@ def get_full_system_inventory() -> Dict[str, Any]:
|
||||
"architecture": os_info.get("architecture"),
|
||||
"cpu_count": os.cpu_count() or 1,
|
||||
"memory_total_mb": mem_total_mb,
|
||||
"memory_percent": mem_percent,
|
||||
"disk_total_gb": disk_total_gb,
|
||||
"disk_free_gb": disk_free_gb,
|
||||
"disk_percent_free": disk_pct_free,
|
||||
|
||||
Reference in New Issue
Block a user