pi status server update

This commit is contained in:
2026-02-16 21:08:40 +09:00
parent 706c7ac21b
commit 5c16e6deb7

View File

@@ -60,7 +60,17 @@ def _get_net_throughput() -> tuple[float, float]:
return rx_kbps, tx_kbps return rx_kbps, tx_kbps
# only services that matter
SERVICES_ALIASES = {
"gitea": "gitea",
"samba": "samba",
"pihole": "pihole",
"qbittorrent": "qbittorrent",
"frpc-primary": "frpc (ny)",
"pinepods": "pinepods",
"frpc-ssh": "frpc (ssh)",
"jellyfin": "jellyfin",
}
def _get_docker_services() -> list[dict]: def _get_docker_services() -> list[dict]:
"""Query Docker for real container statuses with ternary status model.""" """Query Docker for real container statuses with ternary status model."""
try: try:
@@ -81,6 +91,7 @@ def _get_docker_services() -> list[dict]:
continue continue
name, raw_status = parts name, raw_status = parts
if (name in SERVICES_ALIASES):
if raw_status.startswith("Up"): if raw_status.startswith("Up"):
if "unhealthy" in raw_status or "Restarting" in raw_status: if "unhealthy" in raw_status or "Restarting" in raw_status:
status = "warning" status = "warning"
@@ -88,8 +99,7 @@ def _get_docker_services() -> list[dict]:
status = "running" status = "running"
else: else:
status = "stopped" status = "stopped"
services.append({"name": SERVICES_ALIASES[name], "status": status})
services.append({"name": name, "status": status})
# Sort: warnings first, then stopped, then running (problems float to top) # Sort: warnings first, then stopped, then running (problems float to top)
order = {"warning": 0, "stopped": 1, "running": 2} order = {"warning": 0, "stopped": 1, "running": 2}