π Website Status Monitor
π Checking all websites...
π Admin Credentials
Email testing requires admin authentication.
π§ Send Test Email
Verify your email alert system is working. Enter a recipient address and click Send.
π§ Quick Test All Groups
Send a test email to each group's alert recipient to verify all routing is working.
βΉοΈ 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 returning200 OKand 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 toprobe_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_bypassflag 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 (downordegraded), 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.