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=xmlwith 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:
- Log in to vigilmon.online and click Add Monitor.
- Set Type to
HTTP / HTTPS. - Enter the URL:
- Direct (internal):
http://your-server:2812 - Proxied (external):
https://monit.yourdomain.com
- Direct (internal):
- If Monit requires HTTP Basic Auth, add credentials via Vigilmon's Custom headers field:
Authorization: Basic BASE64(admin:yourpassword) - Set Check interval to
1 minute. - Set Expected HTTP status to
200. - 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:
- Click Add Monitor → HTTP / HTTPS.
- Set the URL to
https://monit.yourdomain.com/_status?format=xml. - Add the Basic Auth header as in Step 2.
- Set Expected HTTP status to
200. - Enable Keyword check and enter
<monit>as the required string (present in all valid Monit XML responses). - Set Check interval to
2 minutes. - 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:
- Duplicate the
/_statusmonitor from Step 3. - Change the keyword check to a string that indicates a healthy state in the XML, such as
<status>0</status>(Monit uses0for OK status). - 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:
- Open the HTTPS monitor created in Step 2.
- Scroll to the SSL certificate section.
- Enable Monitor SSL certificate.
- Set Alert when certificate expires in less than
21 days. - 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:
- In Vigilmon, click Add Monitor → Cron Heartbeat.
- Set the name to
Monit daemon. - Set Expected ping interval to
2 minutes. - 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
- Go to Alert Channels in Vigilmon and add Slack, email, PagerDuty, or a webhook.
- Set Consecutive failures before alert to
2on the web dashboard monitor. - Set Consecutive failures before alert to
1on the heartbeat monitor — a missed heartbeat means Monit may be down. - 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.