tutorial

Monitoring Monit with Vigilmon

Monit is a lightweight process and system monitoring daemon — but its web UI and daemon itself need external oversight. Here's how to monitor Monit's web interface, status endpoint, and daemon health with Vigilmon.

Monit is one of the most battle-tested lightweight monitoring daemons on Linux. It watches processes, files, filesystems, and network services — and can automatically restart crashed processes without any external intervention. But Monit's web interface runs on port 2812, and if the Monit daemon itself crashes, there's nothing left to restart it. Vigilmon provides the external safety net: continuously probing Monit's web UI, parsing its status endpoint, and alerting you if the Monit daemon goes offline.

What You'll Set Up

  • HTTP uptime monitor for the Monit web dashboard (port 2812)
  • Status endpoint monitor for /_status?format=xml with keyword check
  • SSL certificate alerts for Monit's HTTPS web interface
  • Cron heartbeat to detect Monit daemon failures

Prerequisites

  • Monit 5.26+ installed and running (apt install monit / yum install monit)
  • Monit web interface enabled in /etc/monit/monitrc
  • A reverse proxy (nginx, Caddy) if exposing Monit over HTTPS
  • A free Vigilmon account

Step 1: Enable the Monit Web Interface

If you haven't already enabled Monit's web interface, add the following to /etc/monit/monitrc:

set httpd port 2812 and
  use address localhost
  allow admin:yourpassword

Then reload Monit:

sudo monit reload

Verify the web interface is running:

curl -u admin:yourpassword http://localhost:2812/
# Should return HTML for the Monit status dashboard

For external access, proxy through nginx rather than binding Monit directly to a public IP.


Step 2: Monitor the Monit Web Dashboard

Add a Vigilmon HTTP monitor for the Monit web interface:

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter the URL:
    • Direct (internal): http://your-server:2812
    • Proxied (external): https://monit.yourdomain.com
  4. If Monit requires HTTP Basic Auth, add credentials via Vigilmon's Custom headers field:
    Authorization: Basic BASE64(admin:yourpassword)
    
  5. Set Check interval to 1 minute.
  6. Set Expected HTTP status to 200.
  7. Click Save.

Because Monit's web interface is often bound to localhost and proxied, monitor the proxied HTTPS URL so Vigilmon tests the full stack: proxy → Monit → response.


Step 3: Monitor the /_status Endpoint

Monit exposes a machine-readable status endpoint at /_status?format=xml that lists all monitored services and their current state. This is more useful than checking the HTML dashboard because you can validate content with a keyword check:

  1. Click Add MonitorHTTP / HTTPS.
  2. Set the URL to https://monit.yourdomain.com/_status?format=xml.
  3. Add the Basic Auth header as in Step 2.
  4. Set Expected HTTP status to 200.
  5. Enable Keyword check and enter <monit> as the required string (present in all valid Monit XML responses).
  6. Set Check interval to 2 minutes.
  7. Click Save.

For a more targeted check, use a specific service name from your Monit config:

# Find your service names
sudo monit status | grep 'Process'

Then set the keyword to the process name (e.g., nginx) to confirm Monit is actively tracking it.


Step 4: Keyword Check for Service/Process Health

Beyond confirming Monit is running, you can use Vigilmon's keyword check to monitor the health of services Monit itself is watching. Add a monitor for the status endpoint with a keyword that should appear only when services are healthy:

  1. Duplicate the /_status monitor from Step 3.
  2. Change the keyword check to a string that indicates a healthy state in the XML, such as <status>0</status> (Monit uses 0 for OK status).
  3. Enable Alert on keyword absence — if this string is missing, something Monit tracks has failed.

This gives you an external view into whether any Monit-managed process is in a failed or restarting state, without needing to log into the server.


Step 5: SSL Certificate Alerts for the HTTPS Interface

If you proxy Monit's web interface over HTTPS (recommended for any public-facing use), monitor the certificate:

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

Verify the certificate manually:

echo | openssl s_client -connect monit.yourdomain.com:443 2>/dev/null \
  | openssl x509 -noout -enddate

A lapsed certificate on the Monit interface means you lose visibility into your server's process health exactly when you might need it most.


Step 6: Heartbeat Monitoring for Monit Daemon Availability

Monit can restart processes — but nothing restarts Monit if it crashes. Use a cron job to send a heartbeat to Vigilmon every minute, confirming Monit is alive:

Create the heartbeat monitor:

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the name to Monit daemon.
  3. Set Expected ping interval to 2 minutes.
  4. Copy the heartbeat URL (e.g. https://vigilmon.online/heartbeat/abc123).

Add the heartbeat to Monit's monitoring cycle:

Add this to /etc/monit/conf.d/vigilmon-heartbeat:

check program vigilmon-heartbeat
  with path "/usr/bin/curl -s https://vigilmon.online/heartbeat/abc123"
  every 1 cycles
  if status != 0 then alert

Reload Monit:

sudo monit reload
sudo monit status vigilmon-heartbeat

Now every time Monit runs its check cycle (typically every 30 seconds), it also pings the Vigilmon heartbeat. If Monit crashes, the heartbeat stops after at most 2 minutes, and Vigilmon sends an alert.

Alternatively, use a system cron job as a belt-and-suspenders check:

* * * * * /usr/bin/pgrep monit >/dev/null && curl -s https://vigilmon.online/heartbeat/abc123

Step 7: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, PagerDuty, or a webhook.
  2. Set Consecutive failures before alert to 2 on the web dashboard monitor.
  3. Set Consecutive failures before alert to 1 on the heartbeat monitor — a missed heartbeat means Monit may be down.
  4. Set the Recovery notification on all monitors so you know when Monit comes back online.

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web dashboard | https://monit.yourdomain.com | Web interface down | | Status endpoint | /_status?format=xml with keyword | API/status broken | | Service health keyword | <status>0</status> | Managed process failures | | SSL certificate | HTTPS domain | Certificate expiry | | Cron heartbeat | Vigilmon heartbeat URL | Monit daemon crash |

Monit is exceptional at self-healing your server's processes — but only while it's running. With Vigilmon monitoring the web interface, parsing the status endpoint for actual service health, and receiving heartbeats from Monit's own check cycle, you close the gap where the monitor itself becomes a single point of failure.

Monitor your app with Vigilmon

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

Start free →