# Uptime monitor and status page ## Rules - One file: `monitor.py` (tests go in `test_monitor.py`). Python 3.10+. - Standard library only: urllib, sqlite3, http.server, threading, json. Do not add pip packages. - Config lives in `sites.json`. Data lives in `status.db` (SQLite, WAL mode). - Store every time in UTC as ISO 8601 (`2026-11-08T14:03:00Z`). Show times in UTC on the page. - Escape every value you put into HTML with `html.escape`. - A check is ok for any 2xx or 3xx response within 10 seconds. - An incident opens after 2 failed checks in a row and closes on the first success. Never two open incidents for one site. - Network failures (including webhooks) are logged and never crash the monitor. - Keep functions small and named for what they do. No classes unless they make the code shorter. ## Commands - `python monitor.py --once` check every site once - `python monitor.py` run the checks forever (`--interval N` to override) - `python monitor.py --serve` checks + status page on http://localhost:8080 (`--port N`) - `python -m unittest` run the tests