Add container health status, multi-volume storage, auto-refresh Overview
Deploy Dashboard / deploy (push) Successful in 35s
Deploy Dashboard / deploy (push) Successful in 35s
This commit is contained in:
@@ -13,6 +13,7 @@ def list_containers():
|
||||
"id": c.short_id,
|
||||
"name": c.name,
|
||||
"status": c.status,
|
||||
"health": (c.attrs.get("State", {}).get("Health", {}) or {}).get("Status", ""),
|
||||
"image": c.image.tags[0] if c.image.tags else str(c.image.id)[:20],
|
||||
"ports": c.ports,
|
||||
}
|
||||
|
||||
@@ -28,6 +28,14 @@ async def send_notification(body: dict):
|
||||
@router.get("/stats")
|
||||
def system_stats():
|
||||
disk = shutil.disk_usage("/volume1")
|
||||
volumes = []
|
||||
for mount in psutil.disk_partitions():
|
||||
if mount.mountpoint.startswith(("/volume",)):
|
||||
try:
|
||||
u = shutil.disk_usage(mount.mountpoint)
|
||||
volumes.append({"mount": mount.mountpoint, "total": u.total, "used": u.used, "free": u.free, "percent": round(u.used / u.total * 100, 1)})
|
||||
except Exception:
|
||||
pass
|
||||
mem = psutil.virtual_memory()
|
||||
cpu_pct = psutil.cpu_percent(interval=0.5)
|
||||
load_1, load_5, load_15 = psutil.getloadavg()
|
||||
@@ -53,6 +61,7 @@ def system_stats():
|
||||
},
|
||||
"uptime": f"{days}d {hours}h",
|
||||
"platform": platform.platform(),
|
||||
"volumes": volumes,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user