🌐 Website Status Monitor

Auto-check every 5 min β€” βš™οΈ Admin
πŸ“‘ Live Status
πŸ“Š Uptime & Charts
🚨 Incidents
πŸ“§ Alerts Log
πŸ§ͺ Email Test
ℹ️ About

πŸ” Checking all websites...

πŸ“ˆ Select a period to view uptime data
πŸ”„ Loading...
πŸ”„ Loading...

ℹ️ About This Monitor

A real-time website monitoring dashboard that tracks the availability, response time, and uptime of multiple websites across different business groups. When a site goes down, email alerts are automatically sent to the designated group contact.

πŸ› οΈ Tech Stack

Cloudflare Pages

Hosts the static dashboard and serves it globally via Cloudflare's CDN edge network with near-instant load times.

Pages Functions

Serverless Workers at the edge. Each site is checked individually with 8-second timeout to stay within execution limits.

Cloudflare D1

SQLite serverless database. Stores 30 days of check history, alert logs, and monitored site configuration.

Gmail API

Sends alert emails via Google Workspace service account with JWT/OAuth2 β€” no stored passwords needed.

Chart.js

Charting for uptime, TTFB average vs peak, headers-vs-full-response, throughput, cache hit rate, and per-vantage path latency over time.

Globalping

External vantage measurements from Hong Kong and Singapore, plus a direct origin-IP probe that bypasses Cloudflare to see the edge→origin leg.

WAF Integration

Monitors sites behind Cloudflare challenge pages using secure WAF skip rules, governed by a per-site waf_bypass flag.

βš™οΈ How It Works

  • πŸ” Health Check: Cron worker checks each site individually in parallel via /api/check?url=X. Each check takes two samples and reads the full response body, recording TTFB, total time, bytes received versus advertised, throughput, and β€” if it failed β€” which phase failed (dns / connect / tls / http / body / timeout).
  • πŸ“¦ Why the body matters: A check that only awaits fetch() is measuring time-to-first-byte and trusting the status line β€” so a site returning 200 OK and then never finishing its body scores as healthy. That is exactly the failure mode that a headers-only monitor misses.
  • πŸ§ͺ Asset Probe: Optionally, a small file on the same host is measured alongside the page. A 4 KB file that answers in ~0.16 s while the homepage needs ~1.5 s means the CMS is slow, not the network.
  • πŸ”Ž External Vantages: Every 15 minutes, probes from Hong Kong, Singapore and mainland China measure each site from outside Cloudflare, plus a direct origin-IP probe that bypasses Cloudflare entirely to see the edgeβ†’origin leg. The China vantages are residential ISPs β€” China Unicom, China Mobile and China Telecom β€” not cloud hosts, because those route internationally very differently from one another. A fault that appears on some cities but not others is a transit fault; one that appears everywhere is the origin.
  • πŸ“Š Dashboard: The dashboard reads the latest stored results via /api/latest, so what you see is what the alerting acted on. "Check Now" runs a live read-only batch check on demand.
  • πŸ’Ύ D1 Logging: Every cron result is stored in status_log; external probes go to probe_log. Records older than 30 days are automatically purged.
  • πŸ”” Alert Routing: Two alert types, each rate-limited to once per URL per hour: down (did not answer, or the body never completed) and degraded (answered, but slowly, intermittently, or short of bytes). Down takes precedence. Dedup is atomic to prevent duplicate alerts.
  • πŸ“§ Daily Summary: At 9AM HKT, a summary email with fleet p95 TTFB and per-site p50/p95 goes to all recipients.
  • πŸ›‘οΈ Admin Panel: Add, edit, or remove monitored sites, and set per-site thresholds and probes, through the admin panel (password protected).
  • 🌐 WAF Integration: Cloudflare zones are configured with WAF skip rules (including SBFM + managed rules) to allow monitoring traffic through challenge pages. The bypass header is sent only to sites whose waf_bypass flag is set, never to third-party URLs.
  • πŸ”’ Security: Cron endpoints require a shared secret; external ingest requires a bearer token. Security headers on all responses. Chart.js loaded with SRI integrity check.

πŸ—„οΈ Database Schema

  • πŸ“‹ monitored_sites β€” URL, group, alert email, enabled flag, per-site thresholds and probes
  • πŸ“Š status_log β€” Timestamp, URL, group, HTTP status, ok flag, plus TTFB, total, bytes, throughput, sample counts, fail phase, cache status and edge colo
  • πŸ”Ž probe_log β€” External vantage results: DNS / TCP / TLS / TTFB / download timings per location
  • πŸ—ΊοΈ probes β€” Registry of measurement vantages
  • πŸ“§ alerts_sent β€” URL, alert type (down or degraded), timestamp, message

πŸ“¬ Alert Recipients

Each group has a designated alert email configured via the Admin Panel. Alert emails are rate-limited to 1 per URL per hour to prevent spam.

All degradation thresholds default to off (0) and are set per site in Admin → Monitoring options. External vantages need an origin_ip to probe the edge→origin leg, and an asset URL to separate CMS slowness from network slowness.