logo
NotesNotesResumeResume
© 2026 Kiet Nguyen
← Projects
2026ToolchainComplete

Host Health Report

Stdlib Python collector that builds an interpreted host-health report (CPU load, memory, disk, optional log sample), writes JSON and text, and runs unattended on a systemd timer.

Stack·Python 3 · systemd timer · JSON · Linux /proc

Signals·CPU/mem/disk · interpreted report · systemd timer · JSON+text

Requirements outline

Scope this page covers. Each row is an acceptance item the automation targets; delivery is what ships in this revision.

IDRequirementDelivery
FR1Real host metricsloadavg + nproc, /proc/meminfo, disk_usage on configurable path, optional log tail
FR2Interpreted reportfindings with severity + summary + detail; overall_severity worst-of core checks
FR3Structured outputJSON for machines and text for operators (format=both by default)
FR4Graceful partial failurePer-collector try/except OSError; collection_errors in report; no bare except
FR5Configurable knobsJSON config + CLI for thresholds, paths, format, output dir
FR6Scheduled unattended runsystemd .service + .timer; reports under /var/lib/host-health/reports with real timestamps

Evidence

Terminal-style capture of latest host health text report overall OK
latest.txt — interpreted host health (ass-lab)
systemd list-timers and journalctl evidence for host-health-report
systemd timer + journal — unattended runs
Structured JSON findings snapshot from latest.json
latest.json — findings
Raw collector metrics ok flags and used percentages
Collectors — raw metrics

Terminal captures from the lab host. Click an image to expand fullscreen.

Problem

I needed a small, dependency-free way to sample host pressure on a Linux box, turn the numbers into a severity judgment against thresholds, and leave timestamped artifacts a timer can produce without me watching the machine.

Approach

Python package host_health (collect → interpret → report). Collectors for loadavg, /proc/meminfo, disk_usage, and optional log tails isolate OSError per metric. Findings carry ok/warn/crit/unknown with detail strings; overall_severity drives exit codes. Config via config/default.json plus CLI overrides. Deployed with a oneshot systemd service and a 5-minute timer under /opt on Multipass Ubuntu 24.04 (ass-lab).

Outcomes

  • Manual and systemd-triggered runs write health-<host>-<utc>.json/.txt plus latest symlinks
  • Timer host-health-report.timer enabled and active on ass-lab (every 5 minutes)
  • Real latest.txt overall OK with CPU/memory/disk findings (evidence/ in repo)
  • Partial log path misses stay informational and do not crash the run
  • No third-party Python deps; no secrets

Status is honest: Study and In progress mean the work is not overclaimed as production-complete.

Back to project index