tutorial

Monitoring Flarum with Vigilmon

Flarum is a modern PHP forum with a RESTful JSON API and elegant SPA design — here's how to monitor its web UI, API endpoints, SSL certificates, and Laravel-scheduled background tasks with Vigilmon.

Flarum is a modern open-source forum platform built on Laravel and Mithril.js, offering a clean single-page application experience, a RESTful JSON API, and zero jQuery dependencies. It's designed as a fresh replacement for aging forum software and is popular for community discussions and support forums. Self-hosting Flarum means you're responsible for its uptime — from the SPA shell to the API layer to the Laravel task scheduler running extension cron jobs. Vigilmon monitors all of these surfaces and alerts you before your users notice anything is wrong.

What You'll Set Up

  • HTTP uptime monitor for the Flarum web UI
  • REST API availability check on /api
  • Discussion endpoint check on /api/discussions
  • SSL certificate expiry alerts for HTTPS deployments
  • Cron heartbeat for Flarum Laravel-scheduled tasks (email digests, extension cron jobs)

Prerequisites

  • Flarum installed and accessible over HTTP or HTTPS
  • A free Vigilmon account

Step 1: Monitor the Flarum Web UI

Flarum's homepage serves the SPA shell. If it goes down, users cannot load the forum at all.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Flarum URL: https://forum.yourdomain.com.
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

A 200 response from the root confirms your web server is running and PHP-FPM is processing Flarum requests.


Step 2: Monitor the Flarum REST API (/api)

Flarum's own SPA frontend communicates entirely through its REST API. The /api root endpoint returns a JSON document describing available API resources and is a reliable indicator that Flarum's application layer is healthy — not just the web server.

  1. Add a new monitor with Type HTTP / HTTPS.
  2. Enter: https://forum.yourdomain.com/api
  3. Set Expected HTTP status to 200.
  4. Enable Keyword check and enter "data" (always present in the API root response).
  5. Set Check interval to 2 minutes.
  6. Click Save.

The keyword check ensures you're receiving a valid JSON API response, not a PHP error page that your web server forwards with a 200 status.


Step 3: Monitor the Discussions Endpoint (/api/discussions)

The /api/discussions endpoint is Flarum's primary content API — it's what the SPA calls to populate the discussion list. An error here means users see a blank forum even if the SPA shell loads correctly.

  1. Add a new monitor with Type HTTP / HTTPS.
  2. Enter: https://forum.yourdomain.com/api/discussions
  3. Set Expected HTTP status to 200.
  4. Enable Keyword check and enter "data".
  5. Set Check interval to 5 minutes.
  6. Click Save.

This check catches database connection failures, ORM errors, or extension conflicts that affect content retrieval but not static asset delivery.


Step 4: SSL Certificate Alerts

Flarum forums are public-facing and rely on HTTPS. A lapsed certificate turns every visitor away before they can even reach your forum.

  1. Open the HTTP monitor for https://forum.yourdomain.com (created in Step 1).
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

If you run Flarum on a subdomain with a separate certificate, add a standalone SSL monitor for that domain. The 21-day alert window gives you enough time to renew before browsers display security warnings.


Step 5: Heartbeat Monitoring for Flarum Scheduled Tasks

Flarum's email notification digests and extension-driven cron jobs run through Laravel's task scheduler. These jobs produce no HTTP errors when they fail — the forum continues loading while emails go undelivered and extension maintenance tasks fall behind. Use Vigilmon's cron heartbeat to verify scheduled tasks complete on time.

Create a Heartbeat Monitor

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Give it a name like Flarum email digest.
  3. Set the expected ping interval to match your scheduler frequency (e.g., 60 minutes for hourly tasks).
  4. Copy the heartbeat URL (e.g., https://vigilmon.online/heartbeat/abc123).

Wrap the Laravel Scheduler

The system cron entry for Flarum's Laravel scheduler typically looks like:

* * * * * cd /path/to/flarum && php flarum schedule:run >> /dev/null 2>&1

Wrap it to ping Vigilmon after each successful run:

* * * * * cd /path/to/flarum && php flarum schedule:run && curl -s https://vigilmon.online/heartbeat/abc123

The && operator ensures the ping only fires when schedule:run exits successfully. If the PHP process crashes or the scheduler exits with an error, the heartbeat is never sent and Vigilmon alerts after the expected interval.

Monitor a Specific Extension Task

For a high-value extension task (e.g., a nightly digest), create a dedicated heartbeat and ping it from the extension's scheduled command:

// In your extension's ScheduledTask command handle() method
public function handle(): void
{
    $this->sendDigestEmails();

    // Signal Vigilmon that this run completed
    Http::get('https://vigilmon.online/heartbeat/abc123');
}

Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, or a webhook.
  2. Set Consecutive failures before alert to 2 on the web UI monitor — PHP-FPM restarts or Nginx reloads can cause a single transient failure.
  3. Suppress alerts during Flarum upgrades or extension installs with a maintenance window:
curl -X POST https://vigilmon.online/api/maintenance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"monitor_id": "abc123", "duration_minutes": 15}'

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web UI | https://forum.yourdomain.com | Web server or PHP-FPM down | | REST API root | /api | Laravel application failure | | Discussions API | /api/discussions | Database errors, ORM failure | | SSL certificate | Forum domain | Certificate expiry, renewal failure | | Cron heartbeat | Heartbeat URL | Email digests stopped, extension tasks missed |

Flarum's SPA architecture means the homepage can load from cached assets while the API is completely broken — users see a blank discussion list with no error message. Monitoring /api and /api/discussions separately from the root URL catches exactly this failure mode before your community notices.

Monitor your app with Vigilmon

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

Start free →