DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Strapi CMS APIs with Vigilmon

Strapi is a popular headless CMS — but when your Strapi API goes down, every frontend that depends on it breaks. This guide shows how to monitor your Strapi instance with Vigilmon.

Why Strapi Monitoring Matters

Strapi runs as a Node.js server. It can crash after a bad migration, run out of memory under load, or have its database connection fail. When it's down, your Gatsby, Next.js, or React frontend can't fetch content.

Step 1: Use Strapi's Built-In Health Endpoint

Strapi includes a built-in health check at /_health:

GET https://your-strapi-instance.com/_health
Enter fullscreen mode Exit fullscreen mode

Response when healthy: { "message": "ok" }

In Vigilmon:

  • URL: https://your-strapi-instance.com/_health
  • Check interval: 1 minute
  • Multi-region: enabled

Step 2: Add a Database Health Check

Strapi's built-in /_health doesn't verify database connectivity. Add a custom endpoint:

// src/api/health/routes/health.js
module.exports = {
  routes: [
    {
      method: 'GET',
      path: '/health/full',
      handler: 'health.check',
      config: { auth: false, policies: [], middlewares: [] },
    },
  ],
};
Enter fullscreen mode Exit fullscreen mode
// src/api/health/controllers/health.js
module.exports = {
  check: async (ctx) => {
    try {
      await strapi.db.connection.raw('SELECT 1');
      ctx.body = { status: 'ok', database: 'connected', timestamp: new Date().toISOString() };
    } catch (error) {
      ctx.status = 503;
      ctx.body = { status: 'error', database: 'disconnected', message: error.message };
    }
  },
};
Enter fullscreen mode Exit fullscreen mode

Monitor /api/health/full — it returns 503 if the database connection is broken.

Step 3: Set Up Alerts

In Vigilmon, configure alerts:

  • Slack: your dev team's channel
  • Email: on-call engineer
  • Webhook: PagerDuty or OpsGenie

The goal: get alerted within 60 seconds, before users notice broken content.

Step 4: Strapi on Cloud Platforms

Render free tier spins down after inactivity — Vigilmon's ping acts as a keepalive AND a monitor.

Railway, Heroku: monitor your app's domain or custom domain.

What Vigilmon Catches for Strapi

Issue Detection
Strapi crashed HTTP 5xx or connection refused
Database disconnected Custom endpoint returns 503
Render spin-down No response within timeout
Bad migration broke startup Server fails to start, monitor alerts

Summary

  1. Monitor /_health for basic availability
  2. Add a custom /api/health/full endpoint for DB checks
  3. Set alerts to Slack/email
  4. Enable multi-region checks

Vigilmon — uptime monitoring for Strapi, Directus, Payload, and every headless CMS. Free plan available.

Top comments (0)