tutorial

How to Monitor Netlify with Vigilmon

Monitor your Netlify-deployed apps with Vigilmon — build pipeline health, serverless function uptime, edge middleware checks, heartbeat monitors for scheduled functions, and a public status page.

Netlify deploys your JAMstack, Next.js, and static sites globally in seconds — but a successful deploy does not mean your app is healthy. A broken serverless function, a failed form submission handler, edge middleware that silently rewrites requests into a 404, or a scheduled function that stopped firing after a timeout — these failures are invisible on Netlify's dashboard until users complain. Vigilmon gives you the external HTTP monitors, heartbeat monitors, and public status page that Netlify doesn't provide out of the box.

This tutorial wires a Netlify-deployed app into Vigilmon end-to-end.

What You'll Build

  • A /.netlify/functions/health serverless function that checks your app's dependencies
  • Vigilmon HTTP monitors for your main site and your functions endpoint
  • A Netlify scheduled function that pings a Vigilmon heartbeat on each successful run
  • A public Vigilmon status page you can embed in your README or app

Prerequisites

  • A Netlify-deployed site with at least one Netlify Function
  • Node.js 18+ (for the function code)
  • A free account at vigilmon.online

Step 1: Create a Health Check Serverless Function

Netlify Functions run as AWS Lambda-backed serverless functions at /.netlify/functions/<name>. Create a health check function that probes your downstream dependencies.

netlify/functions/health.ts

import type { Handler, HandlerEvent, HandlerContext } from "@netlify/functions";

const handler: Handler = async (event: HandlerEvent, context: HandlerContext) => {
  const checks: Record<string, string> = {};
  let ok = true;

  // Check your primary API or database endpoint
  try {
    const resp = await fetch(
      process.env.DATABASE_HEALTH_URL ?? "https://example.com/ping",
      { signal: AbortSignal.timeout(3000) }
    );
    checks.database = resp.ok ? "ok" : `http_${resp.status}`;
    if (!resp.ok) ok = false;
  } catch (err) {
    checks.database = `error: ${(err as Error).message}`;
    ok = false;
  }

  // Check a secondary upstream (e.g. auth provider or CMS)
  try {
    const resp = await fetch(
      process.env.CMS_HEALTH_URL ?? "https://example.com/cms-ping",
      { signal: AbortSignal.timeout(2000) }
    );
    checks.cms = resp.ok ? "ok" : `http_${resp.status}`;
    if (!resp.ok) ok = false;
  } catch (err) {
    checks.cms = `error: ${(err as Error).message}`;
    ok = false;
  }

  return {
    statusCode: ok ? 200 : 503,
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      status: ok ? "ok" : "degraded",
      checks,
      region: process.env.AWS_REGION ?? "unknown",
    }),
  };
};

export { handler };

Deploy and verify:

curl https://<your-site>.netlify.app/.netlify/functions/health
# {"status":"ok","checks":{"database":"ok","cms":"ok"},"region":"us-east-1"}

Step 2: Add Vigilmon HTTP Monitors

With your health function live, add two monitors in Vigilmon: one for the main site and one for the function endpoint.

Main site monitor

  1. Log in to VigilmonAdd Monitor → HTTP.
  2. URL: https://<your-site>.netlify.app/
  3. Check interval: 60 seconds
  4. Expected status: 200
  5. Label: "Netlify — main site"

Serverless function monitor

  1. Add Monitor → HTTP.
  2. URL: https://<your-site>.netlify.app/.netlify/functions/health
  3. Check interval: 60 seconds
  4. Response timeout: 10 seconds (cold-start budget for Lambda-backed functions)
  5. JSON assertion: status = ok
  6. Label: "Netlify — health function"

Set alert threshold to 2 consecutive failures before firing an alert to reduce noise from transient cold-start delays.


Step 3: Monitor a Netlify Scheduled Function with a Heartbeat

Netlify Scheduled Functions run your code on a cron schedule using @netlify/functions. If the schedule silently stops (quota, deployment regression, runtime crash), you won't know without an external heartbeat monitor.

Install the dependency

npm install @netlify/functions

netlify/functions/daily-sync.ts

import { schedule } from "@netlify/functions";

const handler = schedule("0 6 * * *", async () => {
  try {
    // Your actual scheduled work
    await syncDailyData();

    // Ping Vigilmon heartbeat on success
    await fetch(process.env.VIGILMON_HEARTBEAT_URL!, { method: "POST" });

    return { statusCode: 200 };
  } catch (err) {
    // Do NOT ping heartbeat — let Vigilmon fire the alert
    console.error("Daily sync failed:", err);
    return { statusCode: 500 };
  }
});

export { handler };

Add to your Netlify environment variables (Site Settings → Environment Variables):

VIGILMON_HEARTBEAT_URL=https://vigilmon.online/api/heartbeat/<your-heartbeat-id>

In Vigilmon, create a Heartbeat monitor and set the grace period to 30 hours (for a daily job). Vigilmon fires an alert if no ping arrives within the grace window.


Step 4: Monitor Edge Middleware

Netlify Edge Functions (Deno-based) run globally before your pages render. A broken middleware rule can silently redirect every request. Add a dedicated monitor for a route that passes through your middleware:

  1. Add Monitor → HTTP.
  2. URL: https://<your-site>.netlify.app/api/protected-route
  3. Expected status: 200 (or the redirect target — verify what a healthy request returns)
  4. Response timeout: 5 seconds (edge functions warm instantly)
  5. Label: "Netlify — edge middleware"

Step 5: Embed the Status Page

Vigilmon generates a public status page for all your monitors. Go to Status Pages → Create, add your Netlify monitors, then embed the badge in your README.md:

[![Uptime](https://vigilmon.online/badge/<monitor-id>.svg)](https://vigilmon.online/status/<status-page-slug>)

Or embed the live widget in your app's footer:

<script
  src="https://vigilmon.online/embed.js"
  data-page="<status-page-slug>"
  data-theme="light"
  async
></script>

Key Metrics to Monitor on Netlify

| Metric | Monitor type | Vigilmon feature | |---|---|---| | Main site availability | HTTP uptime | HTTP monitor, 60 s interval | | Serverless function health | HTTP uptime | HTTP monitor with JSON assertion | | Scheduled function runs | Heartbeat | Heartbeat monitor, 30 h grace | | Edge middleware correctness | HTTP uptime | HTTP monitor on middleware route | | Build pipeline (deploy hook) | Heartbeat | Heartbeat from post-deploy script | | Core Web Vitals regressions | Real-user monitoring | Vigilmon external check + Lighthouse |


Alerting Recommendations

  • Slack webhook — post to #incidents with the monitor name and failure reason
  • Email — on-call address for P0 function outages
  • PagerDuty webhook — for high-severity monitors covering revenue-critical flows

Set re-notification to every 5 minutes while a monitor is down so alerts don't get buried in a busy Slack channel.


Netlify handles your deploy pipeline. Vigilmon handles the question "is my app actually working right now?" — from the outside, the way your users experience it.

Start monitoring your Netlify app today — register free at vigilmon.online.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →