Mainsail turns a Raspberry Pi into a professional 3D printer control center — real-time print progress, webcam streaming, G-code management, and remote access from any browser. But when Moonraker (the Python API bridge) crashes at hour 14 of a 20-hour print, you won't know until you check the webcam and see a cold, stalled extruder. Vigilmon watches your entire printing stack — Mainsail UI, Moonraker API, printer state, and webcam — and alerts you the moment something breaks.
What You'll Set Up
- HTTP uptime monitor for the Mainsail web UI (nginx, port 80)
- Moonraker API health check (port 7125)
- Printer state endpoint response time monitoring (
/printer/info) - Webcam stream availability check (mjpg-streamer/camera-streamer, port 8080)
- TCP monitor for Moonraker socket connectivity
- Alert channel configuration for print-failure notifications
Prerequisites
- Mainsail installed and running (via MainsailOS, KIAUH, or manual setup)
- Moonraker running on port 7125
- A free Vigilmon account
Step 1: Monitor the Mainsail Web UI
Mainsail is served by nginx as a static Vue.js app. If nginx crashes or the Pi loses power, the web UI goes dark.
- Log in to vigilmon.online and click Add Monitor.
- Set Type to
HTTP / HTTPS. - Enter your Mainsail URL:
http://mainsail.localorhttp://YOUR_PI_IP. - Set Check interval to
2 minutes. - Set Expected HTTP status to
200. - Click Save.
If you've set up a domain with SSL (e.g. via Cloudflare Tunnel), use the HTTPS URL and enable Monitor SSL certificate with a 21-day alert threshold.
Step 2: Monitor the Moonraker API
Moonraker is the Python server that bridges Mainsail to Klipper. The web UI can appear available (nginx is up) while Moonraker is down — leaving you unable to start prints or read sensor data.
Add a dedicated Moonraker API health monitor:
- Click Add Monitor →
HTTP / HTTPS. - URL:
http://YOUR_PI_IP:7125/server/info. - Set Check interval to
1 minute. - Set Expected HTTP status to
200. - Set Expected response body contains to
moonraker. - Click Save.
The /server/info endpoint returns JSON including the Moonraker version and component status. A 200 with a valid JSON body confirms the API server is running.
# Verify manually
curl -s http://YOUR_PI_IP:7125/server/info | python3 -m json.tool
Step 3: Monitor Printer State via /printer/info
Even with Moonraker up, Klipper (the MCU firmware daemon) can disconnect from the printer board — a firmware exception, a loose USB cable, or a failed MCU update. The /printer/info endpoint exposes Klipper's connection state.
- Click Add Monitor →
HTTP / HTTPS. - URL:
http://YOUR_PI_IP:7125/printer/info. - Check interval:
2 minutes. - Expected HTTP status:
200. - Expected response body contains:
ready(Klipper reportsstate: "ready"when connected to the MCU). - Click Save.
A response containing "error" or "shutdown" in the state field means Klipper has crashed or the MCU is disconnected. Vigilmon will alert as soon as the expected string check fails.
Step 4: Monitor the Webcam Stream
Webcam streaming (mjpg-streamer or camera-streamer) runs on port 8080 independently of Moonraker. It can crash without affecting the print itself, but it leaves you flying blind on long jobs.
- Click Add Monitor →
HTTP / HTTPS. - URL:
http://YOUR_PI_IP:8080/?action=stream(mjpg-streamer) orhttp://YOUR_PI_IP:8080/stream(camera-streamer). - Check interval:
5 minutes(streaming endpoints are heavier to probe). - Expected HTTP status:
200. - Click Save.
Alternatively, use the snapshot endpoint for a lighter check:
http://YOUR_PI_IP:8080/?action=snapshot
This fetches a single JPEG frame instead of initiating a stream connection, which is faster and more reliable for health checks.
Step 5: TCP Monitor for Moonraker Port
Add a TCP-level monitor to catch cases where Moonraker's HTTP server starts but the port becomes unresponsive (deadlock, socket exhaustion):
- Click Add Monitor →
TCP Port. - Host:
YOUR_PI_IP. - Port:
7125. - Check interval:
1 minute. - Click Save.
Step 6: Heartbeat Monitor for Print Job Completion
For very long prints, you can send Vigilmon a heartbeat ping from a Moonraker macro or a small shell script that runs on the Pi to confirm the print is still progressing:
- Click Add Monitor → Cron Heartbeat.
- Set Expected interval to
30 minutes. - Copy the heartbeat URL.
Add a shell script on the Pi that checks print progress and pings Vigilmon:
#!/bin/bash
# /home/pi/check_print.sh
STATE=$(curl -s http://localhost:7125/printer/objects/query?print_stats \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d['result']['status']['print_stats']['state'])")
if [ "$STATE" = "printing" ] || [ "$STATE" = "complete" ]; then
curl -s https://vigilmon.online/heartbeat/YOUR_HEARTBEAT_ID
fi
Schedule it in crontab:
*/30 * * * * /home/pi/check_print.sh
If the Pi crashes or the print stalls without completing, the heartbeat stops and Vigilmon alerts.
Step 7: Configure Alert Channels
Long prints fail at inconvenient hours. Route alerts where you'll actually see them:
- Go to Alert Channels in Vigilmon.
- Add a Slack or Discord webhook for your home/lab notification channel.
- Add an email alert as a backup.
- On each Moonraker/printer monitor, set Consecutive failures before alert to
2— this avoids false alarms from momentary API timeouts during high-load G-code processing.
For the webcam monitor, set the threshold to 3 — stream endpoints can be slow to respond during peak CPU usage (especially when running on a Pi 3).
Summary
| Monitor | Target | What It Catches |
|---|---|---|
| Mainsail UI | http://PI_IP:80 | nginx crash, Pi power loss |
| Moonraker API | http://PI_IP:7125/server/info | Python API server down |
| Printer state | http://PI_IP:7125/printer/info | Klipper MCU disconnect, firmware crash |
| Webcam stream | http://PI_IP:8080/snapshot | Camera service crash |
| TCP port | PI_IP:7125 | Moonraker socket unresponsive |
| Cron heartbeat | Heartbeat URL | Pi crash during active print |
Mainsail gives you a beautiful interface for your Klipper printer — Vigilmon makes sure that interface and everything behind it stays up through 40-hour overnight prints.