Compare commits

..

4 Commits

Author SHA1 Message Date
mikkeli 8a9e8ba7ff report configured containers Docker never lists as stopped
A name in SERVICES_ALIASES with no matching container (typo or deleted)
produced no `docker ps -a` line, so it silently vanished from the
dashboard instead of showing as a problem. Track which configured names
were seen and append the leftovers as stopped, logging edge-triggered so
a persistent typo doesn't reprint every 2s poll.

Also corrects the kcmonitor container name and refreshes the README
service list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 15:46:01 +09:00
mikkeli a20a8f3552 fixed kcmonitor container name 2026-07-24 12:53:47 +09:00
mikkeli df6c7ea4bc added kc services to watch 2026-07-24 12:52:10 +09:00
mikkeli 595f9916ac minor qol 2026-02-18 10:17:30 +09:00
3 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ Pushes a JSON object every 2 seconds with real system metrics from `psutil`:
- `cpu_pct`, `mem_pct`, `mem_used_mb`, `disk_pct`
- `cpu_temp` (reads `/sys/class/thermal/` as fallback)
- `uptime_hrs`, `net_rx_kbps`, `net_tx_kbps` (values are in kB/s despite the field names)
- `services` — live Docker container statuses via `docker ps -a`, with a ternary status model (`running`, `warning`, `stopped`). Monitored containers: gitea, samba, pihole, qbittorrent, frpc (ny), pinepods, frpc (ssh), jellyfin.
- `services` — live Docker container statuses via `docker ps -a`, with a ternary status model (`running`, `warning`, `stopped`). Monitored containers: gitea, samba, pihole, qbittorrent, frpc (ny), pinepods, frpc (ssh), jellyfin, kc-start2, kc-monitor. A configured container Docker doesn't report at all (deleted, or a typo in `SERVICES_ALIASES`) is reported as `stopped` and logged once to stdout.
- `local_time` fields for RTC sync (`y`, `mo`, `d`, `h`, `m`, `s`)
### contents_server.py -- port 8766
+2 -1
View File
@@ -109,7 +109,8 @@ async def handler(ws):
await asyncio.sleep(1)
else:
# longer image persistence when no audio
await asyncio.sleep(10)
await asyncio.sleep(3)
current_img = img_idle
await send_status_image(ws, current_img)
+24
View File
@@ -70,7 +70,14 @@ SERVICES_ALIASES = {
"pinepods": "pinepods",
"frpc-ssh": "frpc (ssh)",
"jellyfin": "jellyfin",
"kancolle-start2-server": "kc-start2",
"kancolle-kcmonitor": "kc-monitor",
}
# Configured names Docker didn't report, so a typo doesn't reprint every 2s
_missing_containers: set[str] = set()
def _get_docker_services() -> list[dict]:
"""Query Docker for real container statuses with ternary status model."""
try:
@@ -84,7 +91,10 @@ def _get_docker_services() -> list[dict]:
if result.returncode != 0:
return []
global _missing_containers
services = []
seen = set()
for line in result.stdout.strip().splitlines():
parts = line.split("\t", 1)
if len(parts) != 2:
@@ -100,6 +110,20 @@ def _get_docker_services() -> list[dict]:
else:
status = "stopped"
services.append({"name": SERVICES_ALIASES[name], "status": status})
seen.add(name)
# A configured name Docker never reported is either a typo or a deleted
# container — show it as stopped instead of dropping it off the dashboard
missing = set(SERVICES_ALIASES) - seen
for name in sorted(missing):
services.append({"name": SERVICES_ALIASES[name], "status": "stopped"})
if missing != _missing_containers:
for name in sorted(missing - _missing_containers):
print(f"No container named {name!r} — reporting as stopped")
for name in sorted(_missing_containers - missing):
print(f"Container {name!r} is back")
_missing_containers = missing
# Sort: warnings first, then stopped, then running (problems float to top)
order = {"warning": 0, "stopped": 1, "running": 2}