The watcher
The panel lives on the server it watches. When that server dies, it cannot tell you. The watcher closes that gap: it is a small Cloudflare Worker with a D1 database in your own Cloudflare account. Every minute it checks your apps and your machines from outside, and it sends the Telegram alerts itself.
Set it up
- Link Telegram first (Notifications, Telegram). The watcher sends its alerts to the same chat.
- In Cloudflare, open My Profile, API Tokens, and create a custom token with two permissions, nothing else:
- Account · Workers Scripts: Edit
- Account · D1: Edit
- Copy your account ID from the right side of the Cloudflare dashboard’s home page.
- In Yawl, open Notifications, Watcher, paste both, and choose Deploy the watcher.
Yawl then does five things:
- it creates the database
yawl-watch-<panel id>and its tables; - it uploads the Worker under the same name, with a schedule of every minute;
- it turns on its
workers.devaddress; - it hands each agent its own signing key;
- it sends the list of what to check.
A failed step is named with Cloudflare’s own words, for example Could not upload the watcher: Authentication error.
make watch builds the Worker into watch/dist, and go build embeds it. make release and make e2e do it for you. A new release redeploys the Worker by itself within a minute of starting, and so does relinking Telegram.
What it checks
| Check | Comes from | Fails when |
|---|---|---|
| A URL | every live web service: its free URL and each custom domain whose DNS is right, at the service’s health path | a GET answers anything but 2xx or 3xx, or nothing within 10 s, twice in a row |
| A machine | every server whose agent took the watcher’s key (Notifications, Watcher names any that did not; they keep the panel’s own offline alert) | no signal for 3 minutes |
| The panel | the panel’s own signal each minute | no signal for 3 minutes |
| A heartbeat | Notifications, Watcher, Heartbeats | no call within its period plus its grace time |
| A backup | every Postgres service | no successful backup for 26 hours |
When a machine is silent, its apps are not checked separately. You get one message, hel1 is not answering. 3 services on it are not checked separately until it is back., not one per app. When the panel and its own machine are both silent, only the machine’s message is sent.
The messages
One message when an incident opens, one when it closes:
acme/production/api is down: GET https://api.acme.uz answered 502 twice. Since 14:02.acme/production/api is back after 7 minutes.hel1 is not answering.The panel is not answering.laptop backup did not check in: expected every 24 hours, last call 26 Oct 03:00.
Each message ends with one link. It points to the panel’s Incidents page while the panel answers, and to the status page when it does not.
What only the panel can see goes through the watcher too, so the Incidents page holds everything:
- a failed deploy;
- a worker that stopped;
- a disk at 85% or 95%;
- a failed backup.
When the watcher’s own check already covers something, the panel’s message is dropped, so a 502 is announced once.
If the watcher does not acknowledge the panel for 5 minutes (or answers, but its minute has not run for 3 minutes, or a message has waited 10 minutes), the panel says The watcher is not answering: <why>. Alerts come from the panel until it does. and sends alerts itself, as before the watcher existed. Notifications, Watcher shows the cause in red.
The status page
https://yawl-watch-<panel id>.<your subdomain>.workers.dev/status lists only the services you mark: open a service’s Settings tab and tick Show on the status page. None is shown by default.
For each service, the page shows:
- whether it is up now;
- 90 day bars;
- open and recent incidents, with the notes you write on the Incidents page.
The page is served from Cloudflare, so it stays up when your server is down.
Heartbeats
For a job that runs outside Yawl: a laptop backup, a GitHub Action, a cron job on another machine. Add one in Notifications, Watcher, Heartbeats with a name, a period and a grace time. You get a URL, and the job calls it when it finishes:
curl -fsS -m 10 https://yawl-watch-abcd1234.acme.workers.dev/hb/<token>
Limits of Cloudflare’s free plan
| Limit | What it means here |
|---|---|
| 5 cron triggers per account | The watcher uses one. Other Workers in the account share the rest. |
| 50 outbound requests per run, D1 calls included | At most 40 URLs are checked each minute. With more, they take turns, so a URL is checked every two minutes. At most 5 Telegram messages leave per minute; the rest follow the next minute. |
| 100,000 D1 writes a day | A check writes only when its state changes, plus one row a minute: about 1,500 writes a day for 20 URLs. |
Remove it
Notifications, Watcher, Stop using the watcher forgets the token, and alerts come from the panel again. The Worker and its database stay in your account. Delete yawl-watch-<panel id> in the Cloudflare dashboard (Workers and D1) to remove them.
Acceptance on a real account
These need your Cloudflare token, so they are yours to run:
-
Stop
yawl-serverandyawl-agenton the only machine. Within 4 minutes the Worker sendshel1 is not answering; starting them sends the closing message. -
Stop only
yawl-server. You getThe panel is not answering.and no machine message, and the apps’ URL checks go on. -
Make a web service answer 500. Exactly one “is down” message arrives, from the Worker, not a second one from the panel.
-
Fixing it closes the incident with its length.
-
A heartbeat not called within its period plus its grace time opens an incident, and a call closes it.
-
The status page lists only marked services and stays reachable with the server stopped.
-
Revoking the Cloudflare token makes the panel say
The watcher is not answeringwithin 6 minutes. -
A cron job scheduled every minute whose command exits 1 opens an incident. Stop the job’s agent, and the next minute’s run opens “did not run”.
Cron jobs
A Cron Job is a service kind next to Web Service and Postgres. In the dashboard, choose New service and then Cron Job. In yawl.yaml it looks like this:
- name: report
kind: cron
repo: https://github.com/acme/api
schedule: "0 3 * * *" # minute hour day month weekday
timezone: Asia/Tashkent # empty: the panel's own zone
command: [node, jobs/report.js]
timeout: 1h # 1m to 24h; a run past it is stopped and fails
- Where it runs. A deploy builds the image and hands the job to the agent of the environment’s server. The agent runs the job there, so jobs keep running while the panel is down. Each run gets a new container of the latest image, with the environment’s variables, and the container is removed after the run.
- The schedule. It is the classic five fields:
*, numbers, ranges1-5, lists1,15and steps*/10. When both the day of month and the day of week are given, either one matches. Names and@dailyare not accepted. - Clock changes. Times are wall-clock times in the job’s zone. A time skipped by a clock change does not run that day, and a repeated hour runs twice.
- No catching up. A minute missed while the agent was down is not run later; the watcher reports it instead.
- Overlaps. If a run is still going when the next one is due, that next run is skipped, and the Runs tab says so.
- The Runs tab shows the last 20 runs, the last 50 lines of each, the next run time, and Run now.
What is reported, and from where:
- A run that exits with a code other than 0, or passes its limit. The Worker opens an incident at once, from the agent’s own report. Without the watcher, the panel sends the message:
acme/production/report failed at 03:00 (Asia/Tashkent): exit 1 after 41 s. - A run that has not started 2 minutes after its time. Only the watcher can see this:
acme/production/report did not run at 03:00 (Asia/Tashkent). Last run: 26 Oct 03:00, 41 s, exit 0. - A run that started and never finished within its limit. The watcher sees this too, for example when the agent died mid-run.
- The next good run closes the incident.