| name | machin-watch |
| description | Run and configure machin-watch — a tiny uptime monitor (written in machin/MFL) that polls URLs on a per-watch interval and alerts on up<->down transitions via a machin-notify hub. Use this skill to monitor that a deployed service stays up, add/remove watches, run one-shot checks, or run the monitor daemon. |
machin-watch — uptime monitor
Mental model
A daemon polls each watched URL on its own interval. A watch is up on 2xx/3xx,
down on 4xx/5xx or a transport error (dns/connect/tls). State lives in
SQLite (persists across restarts). On a transition (up→down or down→up) it
POSTs an alert to a machin-notify
hub — never on every poll. Built only on existing builtins (http_get, SQLite,
sleep, raw sockets) — no new machin features.
Build
Needs the machin compiler, a C compiler, libsqlite3 (links OpenSSL for HTTPS).
./build.sh
Use
machin-watch add https://example.com --name site --every 60s --channel alerts
machin-watch list
machin-watch check
machin-watch daemon
machin-watch remove site
--every takes 30s/5m/1h/2d or a bare number (seconds). The first check of
a brand-new watch alerts only if it's already down.
Alerts (via machin-notify)
Set the hub token; a per-watch --channel overrides WATCH_NOTIFY_CHANNEL.
WATCH_NOTIFY_TOKEN=<hub-token> WATCH_NOTIFY_CHANNEL=alerts machin-watch daemon
Messages: 🔴 DOWN — name (url)\nstatus 503 (or error: connect) and
🟢 UP — name (url) recovered after 2m. See machin-notify's SKILL.md for the hub.
Configuration (environment)
| var | default | meaning |
|---|
WATCH_DB | watch.db | SQLite watch list + state (use an absolute path when deployed) |
WATCH_NOTIFY_TOKEN | — | machin-notify token (alerts disabled if unset) |
WATCH_NOTIFY_CHANNEL | — | default channel; --channel per watch overrides |
WATCH_NOTIFY_ADDR | 127.0.0.1:48090 | machin-notify daemon address |
Deploy
systemd service, Restart=always, absolute WATCH_DB, and the notify env set —
ExecStart=/path/machin-watch daemon.
Gotchas
- Watches both
http:// and https:// (machin v0.39.0 added plain-HTTP to the client).
- Checks are sequential (each request ~5 s timeout); keep the watch list modest
or expect cycle time to grow with the number of down/slow targets.
- Run the machin-notify hub first —
machin-watch only alerts if it can reach
the hub at WATCH_NOTIFY_ADDR with a valid token.