tutorial

Monitoring Moodle LMS with Vigilmon

Moodle serves 400M+ learners — but a crashed login page or a failed grade sync cron can go unnoticed for hours. Here's how to monitor your Moodle instance's availability, admin health checks, SSL certificates, and scheduled cron tasks with Vigilmon.

Moodle is the world's most widely used open-source Learning Management System, powering courses for over 400 million users across universities, schools, and corporate training platforms. When Moodle goes down during an exam window or a major assignment deadline, the consequences are immediate and visible. Vigilmon gives you continuous uptime monitoring for your Moodle homepage, login page, admin health endpoint, SSL certificates, and the scheduled cron tasks that drive course completion, grade synchronization, and backups.

What You'll Set Up

  • HTTP uptime monitor for the Moodle homepage
  • Login page health check to confirm authentication is functional
  • Admin health check endpoint monitoring (/admin/tool/health/)
  • SSL certificate expiry alerts for your Moodle domain
  • Heartbeat monitoring for Moodle's scheduled cron tasks (course completion, grade sync, backup)

Prerequisites

  • Moodle 3.9+ installed and accessible over HTTP/HTTPS
  • Admin access to configure Moodle's cron and health tools
  • A free Vigilmon account

Step 1: Monitor the Moodle Homepage

The Moodle homepage is the first thing learners see, and its availability confirms that your web server, PHP-FPM, and database connection are all functional.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Moodle URL: https://moodle.yourdomain.com (or http:// if you haven't enabled HTTPS yet).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

Optionally, add a keyword check to confirm actual Moodle content is served rather than a generic web server error page:

  1. Enable Keyword check on the same monitor.
  2. Enter a phrase that appears on your Moodle homepage, such as Log in or your site name.
  3. Set the monitor to alert when the keyword is absent.

This catches cases where the web server returns 200 with an error page (e.g., a PHP fatal error that outputs some HTML before dying).


Step 2: Monitor the Login Page

The login page (/login/index.php) requires PHP session handling, database connectivity, and Moodle's authentication plugins. It can fail independently of the homepage if the session store (Redis, Memcached, or filesystem) has a problem.

  1. In Vigilmon, click Add MonitorHTTP / HTTPS.
  2. Set the URL to: https://moodle.yourdomain.com/login/index.php
  3. Set Expected HTTP status to 200.
  4. Enable Keyword check and enter Username or Log in — text that only appears on a functioning login form.
  5. Set Check interval to 1 minute.
  6. Click Save.

A login page monitor that fires independently of the homepage monitor helps you distinguish between a full outage (both fail) and an authentication-layer problem (login fails while the homepage serves a cached response).


Step 3: Use the Moodle Admin Health Check Endpoint

Moodle ships with a built-in health check tool at /admin/tool/health/ that checks internal subsystems including database connectivity, file permissions, cron status, and plugin integrity. This endpoint requires authentication, but you can configure a dedicated monitoring token.

For unauthenticated health probing, Moodle's CLI health check is more practical from a server-side monitoring script:

# Run Moodle's built-in checks from the CLI
php /var/www/moodle/admin/tool/health/cli/health.php
echo $?  # 0 = healthy, non-zero = issues found

Wrap this in a small health endpoint script served by your web server:

<?php
// /var/www/html/moodle-health.php — accessible only from monitoring IPs
$output = shell_exec('php /var/www/moodle/admin/tool/health/cli/health.php 2>&1');
if (strpos($output, 'No problems found') !== false) {
    http_response_code(200);
    echo json_encode(['status' => 'ok']);
} else {
    http_response_code(503);
    echo json_encode(['status' => 'degraded', 'output' => $output]);
}

Then add a Vigilmon monitor for this endpoint:

  1. In Vigilmon, click Add MonitorHTTP / HTTPS.
  2. Set the URL to: https://moodle.yourdomain.com/moodle-health.php
  3. Set Expected HTTP status to 200.
  4. Enable Keyword check and enter "status":"ok".
  5. Set Check interval to 5 minutes.
  6. Click Save.

Restrict this file to your monitoring IP range in your nginx or Apache config to prevent it from being a public information disclosure endpoint.


Step 4: SSL Certificate Alerts

Moodle deployments nearly always run on HTTPS — learner data and authentication credentials must be protected. A Let's Encrypt certificate expiry during a term can lock every student out of their courses.

  1. Open the HTTPS monitor created in Step 1.
  2. Enable Monitor SSL certificate under the SSL section.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

If you use Let's Encrypt with certbot, verify that auto-renewal is working:

# Check renewal status
sudo certbot renew --dry-run

# View certificate expiry
sudo certbot certificates

Common renewal failures on Moodle servers:

  • Port 80 blocked by a firewall rule (HTTP challenge fails)
  • Certbot cron not running after a server reboot
  • Moodle's .htaccess or nginx config redirecting the ACME challenge path

The 21-day window gives you time to investigate and manually renew before expiry:

sudo certbot renew --force-renewal
sudo systemctl reload nginx  # or apache2

Step 5: Heartbeat Monitoring for Moodle Cron Tasks

Moodle's cron system is critical to LMS operation. Course completion checks, grade synchronization, email notifications, scheduled backups, and activity completion events all run through admin/cli/cron.php. A silent cron failure means grades don't sync, completion certificates don't issue, and backup files go stale.

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the expected ping interval to match your Moodle cron schedule (e.g., 1 minute for the standard recommended interval, or 60 minutes if you run it hourly).
  3. Copy the heartbeat URL (e.g., https://vigilmon.online/heartbeat/abc123).
  4. Modify your cron entry to ping Vigilmon after each successful run:
# Edit the cron job (as the web server user)
sudo crontab -u www-data -e

# Standard Moodle cron entry with Vigilmon heartbeat
* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php > /dev/null 2>&1 && curl -s https://vigilmon.online/heartbeat/abc123

The && ensures Vigilmon is only pinged when the cron script exits with status 0 (success). A PHP fatal error during cron execution suppresses the heartbeat ping, alerting you to the failure.

For high-traffic Moodle instances that use the admin/cli/scheduled_task.php runner for individual tasks, create separate heartbeat monitors per critical task:

# Grade sync heartbeat
* * * * * /usr/bin/php /var/www/moodle/admin/cli/scheduled_task.php --execute='\core\task\grade_cron_task' > /dev/null 2>&1 && curl -s https://vigilmon.online/heartbeat/grade-abc123

# Backup heartbeat (daily at 1 AM)
0 1 * * * /usr/bin/php /var/www/moodle/admin/cli/scheduled_task.php --execute='\core\task\automated_backup_task' > /dev/null 2>&1 && curl -s https://vigilmon.online/heartbeat/backup-abc123

Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, or a webhook.
  2. For the homepage and login monitors, set Consecutive failures before alert to 2 — PHP-FPM process recycling can cause a single probe to fail during high load.
  3. For the cron heartbeat monitor, consider setting up a separate high-priority alert channel (e.g., SMS or PagerDuty) — a missed cron means grade data isn't updating for every learner on your platform.
  4. Use Maintenance windows in Vigilmon during Moodle version upgrades:
# Create a maintenance window before upgrading
curl -X POST https://vigilmon.online/api/maintenance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"monitor_id": "abc123", "duration_minutes": 30}'

# Run Moodle upgrade
sudo -u www-data php /var/www/moodle/admin/cli/upgrade.php --non-interactive

# Maintenance window expires automatically

Summary

| Monitor | Target | What It Catches | |---|---|---| | Homepage uptime | https://moodle.yourdomain.com | Web server, PHP, DB connection failure | | Login page | /login/index.php | Session store, auth plugin failure | | Admin health check | /moodle-health.php | Internal subsystem degradation | | SSL certificate | Moodle domain | Let's Encrypt renewal failure | | Cron heartbeat | Heartbeat URL | Cron failure, PHP errors in scheduled tasks |

Moodle running on your own infrastructure gives you control over data, costs, and customization — but 400 million users worth of LMS experience means your learners expect commercial-grade reliability. With Vigilmon monitoring every layer from the homepage to cron tasks, you'll know about problems before your learners do.

Monitor your app with Vigilmon

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

Start free →