From b275164be9e2252497e0bc8465ebdeff45934a25 Mon Sep 17 00:00:00 2001 From: nessi Date: Mon, 17 Aug 2026 19:21:49 +0200 Subject: [PATCH] feat: add Linux PSI I/O pressure monitoring with real-time dashboard panel and auto-refresh on DOM mutations Add io_pressure() function to parse /proc/pressure/io with line splitting, key-value extraction from some/full metrics, and OSError/ValueError exception handling returning available:False on failure. Add io_pressure() call to datastore_snapshot() return dict. Add DOMContentLoaded script to create #ioPressurePanel section with datastore-panel/io-pressure-panel classes, innerHTML with I/O- --- app.py | 15 ++++++++++++++- templates/index.html | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 7ce4909..fb08f86 100644 --- a/app.py +++ b/app.py @@ -338,6 +338,19 @@ def format_remaining_time(value): parts.append(f"{minutes} Min.") return " ".join(parts) or "< 1 Min." +def io_pressure(): + """Read Linux PSI I/O pressure, if the kernel exposes it.""" + try: + values = {} + for line in Path("/proc/pressure/io").read_text().splitlines(): + parts = line.split() + if not parts: + continue + values[parts[0]] = {key: float(value) for key, value in (item.split("=", 1) for item in parts[1:] if "=" in item)} + return {"some": values.get("some", {}), "full": values.get("full", {}), "available": bool(values)} + except (OSError, ValueError): + return {"some": {}, "full": {}, "available": False} + def smart_status(device): if not SMART_ENABLED: return "Nicht aktiviert" @@ -527,7 +540,7 @@ def datastore_snapshot(): elif current_raid.get("status") != "failed": datastore_cache["raid"] = dict(current_raid) datastore_cache["raid_at"] = now - return {"storage": storage, "raid": current_raid, "cache_seconds": STORAGE_CACHE_SECONDS} + return {"storage": storage, "raid": current_raid, "io_pressure": io_pressure(), "cache_seconds": STORAGE_CACHE_SECONDS} def cpu_usage_percent(): global previous_cpu diff --git a/templates/index.html b/templates/index.html index f328f0d..be1284f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,6 +1,9 @@ +