docs / setup

Setting up monitoring

PingPage works from the outside in: we send HTTP requests to your public URL on a fixed interval and record what comes back. There is nothing to install — but a few minutes of setup makes your monitoring much more meaningful.

1. Pick what to monitor

Any public http(s) URL works. Most devs start with two monitors:

  • Your homepage — catches DNS issues, expired TLS certificates, server crashes, bad deploys.
  • A health endpoint — catches the failures users actually feel: database down, dependencies broken, app deadlocked.

2. Add a health endpoint

A health endpoint is a route that returns 200 only when your app is genuinely working. The strongest version touches your database:

Express

app.get("/health", async (req, res) => {
  try {
    await db.query("SELECT 1");   // is the database alive?
    res.status(200).json({ ok: true });
  } catch {
    res.status(503).json({ ok: false });
  }
});

Next.js (App Router)

// app/api/health/route.ts
import { db } from "@/lib/db";

export async function GET() {
  try {
    await db.$queryRaw`SELECT 1`;
    return Response.json({ ok: true });
  } catch {
    return Response.json({ ok: false }, { status: 503 });
  }
}

Then create a monitor for /health expecting status 200–299. When the database dies, the endpoint returns 503, the check fails, and you get an email.

3. Know how we check

RequestGET or HEAD, following redirects, no body downloaded
User-AgentPingPage/1.0 (+https://usepingpage.com)
Timeout10 seconds by default (configurable 1–30s)
Down conditionStatus outside your expected range, timeout, DNS/TLS/connection error
Anti-flap2 consecutive failures before we declare DOWN and alert
RecoveryFirst successful check flips it back UP and emails you the downtime

If you rate-limit aggressively or block bots, allowlist our User-Agent so your monitoring traffic isn't rejected. Monitoring an auth-protected endpoint? Set the expected status range to 401–401 — a 401 means your app is alive and answering.

4. Publish a status page

In Dashboard → Status pages, create a page, pick a slug, and select which monitors to show. Your users get a live page at:

https://usepingpage.com/status/<your-slug>

It shows live state, 90 days of uptime history, and an incident timeline — and it updates within a minute of a check. Link it from your app's footer or error pages; it answers "is it just me?" before the support email gets written.

5. Test your alerts

Don't wait for a real outage to find out alerts work. Create a monitor pointing at a URL that doesn't exist (e.g. https://your-domain.com/definitely-404 with expected status 200–299). Within ~2 minutes you'll have a DOWN email in your inbox. Delete the test monitor afterwards — or keep it paused for the next fire drill.