Skip to content

feat(ops): install the self-healing host health monitor - #53

Merged
danielroberts20 merged 1 commit into
mainfrom
ops/install-health-monitor
Oct 7, 2026
Merged

danielroberts20 merged 1 commit into
mainfrom
ops/install-health-monitor

Conversation

@danielroberts20

Copy link
Copy Markdown
Owner

Summary

Promotes the reviewed draft of the host health monitor to scripts/check_system_health.py. It is already installed and running on the Pi (root's cron, first real run 09:15 UTC: all checks ran, 0 alerts); this PR makes main match.

  • New checks: required mounts, Docker health status, restart-count increase, per-container OOM kills, systemd services, DB-backup age, Prefect DB size, swap-in rate.
  • Self-healing: restarts unhealthy containers (or the prefect-server unit) with a budget of 3 per 6 hours per container.
  • Fixes: exact container-name matching (the substring match treated travelnet as running whenever travelnet-nginx was); prefect-server is restarted through systemd; the permanently-tripped "swap > 60 %" alert is replaced by swap > 90 % plus swap-in rate.
  • --dry-run mode, and state kept in /var/tmp so it survives reboots.
  • Removes the draft copy in docs/drafts/. server/tests/test_health_script.py (26 tests) now runs against this file directly.

Note for the Pi

The Pi's working tree already contains this exact file as an uncommitted change. After merging, run git checkout -- scripts/check_system_health.py && git pull --ff-only.

🤖 Generated with Claude Code

Promotes the reviewed draft to scripts/check_system_health.py (it was kept in
docs/drafts so root's cron would not pick it up before the containers had
healthchecks). Adds mount, Docker-health, restart-count, per-container OOM,
systemd-service, backup-age and Prefect DB-size checks, restarts unhealthy
containers with a budget of 3 per 6 hours, matches container names exactly,
restarts prefect-server through systemd, replaces the permanently-tripped
"swap > 60%" alert with swap-in rate, and adds --dry-run.

Already installed on the Pi and running from cron; its tests
(server/tests/test_health_script.py) now exercise this file directly.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying travelnet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 14b2289
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying travelnet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 14b2289
Status: ✅  Deploy successful!
Preview URL: https://9a3f1935.travelnet.pages.dev
Branch Preview URL: https://ops-install-health-monitor.travelnet.pages.dev

View logs

@danielroberts20
danielroberts20 merged commit 4b92470 into main Oct 7, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant