diff --git a/app.py b/app.py
index e2f8cfd..cdcc24d 100644
--- a/app.py
+++ b/app.py
@@ -491,7 +491,19 @@ def system_metrics():
disks.append({"label": label, "path": path, "total": format_bytes(usage.total), "used": format_bytes(usage.used), "free": format_bytes(usage.free), "used_bytes": usage.used, "total_bytes": usage.total, "percent": round(usage.used / usage.total * 100, 1) if usage.total else 0})
except OSError:
continue
- return {"cpu_percent": cpu_usage_percent(), "memory": {"used": format_bytes(used_memory), "total": format_bytes(total_memory), "percent": round(used_memory / total_memory * 100, 1) if total_memory else 0}, "disks": disks, "timestamp": time.time()}
+ try:
+ load = os.getloadavg()
+ except (AttributeError, OSError):
+ load = (0, 0, 0)
+ try:
+ uptime_seconds = float(Path("/proc/uptime").read_text().split()[0])
+ except (OSError, ValueError, IndexError):
+ uptime_seconds = 0
+ try:
+ process_count = sum(1 for entry in Path("/proc").iterdir() if entry.name.isdigit())
+ except OSError:
+ process_count = 0
+ return {"cpu_percent": cpu_usage_percent(), "memory": {"used": format_bytes(used_memory), "total": format_bytes(total_memory), "percent": round(used_memory / total_memory * 100, 1) if total_memory else 0}, "disks": disks, "load": [round(value, 2) for value in load], "uptime_seconds": round(uptime_seconds), "processes": process_count, "timestamp": time.time()}
def release_languages(name):
value = f" {name.lower().replace('.', ' ').replace('-', ' ')} "
diff --git a/templates/index.html b/templates/index.html
index 889078b..c717e2c 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,4 +1,6 @@
+
+