Skip to Content
πŸŽ‰ EZMON v0.1.3 is released. Visit ezmon.web.id β†’
InstallationWorker Setup

Worker Setup

The Cloudflare Worker is the global evaluator. It runs on a cron schedule (every 1 minute) to detect offline agents, create incidents, and dispatch notifications.

Install Wrangler CLI

npm install -g wrangler wrangler login
cd apps/worker

Set Worker secrets

npx wrangler secret put DATABASE_URL # Paste your Neon connection string when prompted npx wrangler secret put WORKER_SECRET # Set a strong random string for manual trigger auth

Deploy

npx wrangler deploy

Verify the Worker

After deployment, you can trigger the evaluator manually for testing:

curl -X POST https://your-worker.YOUR_SUBDOMAIN.workers.dev/trigger \ -H "Authorization: Bearer YOUR_WORKER_SECRET"

The cron schedule is configured in apps/worker/wrangler.toml. Default: every 1 minute (* * * * *).

What the Worker Does

Each cron run executes these steps in order:

  1. Detect overdue agents β€” SELECT agents WHERE offline_deadline_at < NOW() AND status != 'offline'
  2. Mark offline + create incident β€” update status, insert incident if none open
  3. Dispatch offline notifications β€” Telegram, Discord, or Webhook
  4. Detect recovered agents β€” SELECT agents WHERE offline_deadline_at >= NOW() AND status = 'offline'
  5. Mark online + resolve incident β€” update status, set resolved_at
  6. Dispatch recovery notifications
  7. Run cloud monitor checks β€” parallel HTTP/TLS/Keyword checks
  8. Retention cleanup β€” delete metric_buckets > 7 days, cloud results > 30 days
Last updated on