
Module 9 Lesson 4: Health Monitoring
Is n8n alive? Learn how to setup heartbeat monitors and healthcheck endpoints to ensure your automation server is always ready for work.
Module 9 Lesson 4: Health Monitoring
A "Self-hosted" server means you are the IT support. If n8n crashes at 3:00 AM, you need to know before your boss starts complaining that no leads arrived.
1. The /healthz Endpoint
n8n provides a hidden URL: https://your-n8n.com/healthz.
- If the server is OK, it returns
HTTP 200. - If the database is locked or RAM is full, it might not respond.
- Tip: Use a tool like Uptime Kuma or BetterStack to ping this URL every 60 seconds.
2. The Internal "Heartbeat" Workflow
The best way to monitor n8n is with n8n itself.
- Trigger: Cron (Every 5 minutes).
- Action: "Heartbeat". This node could "Upsert" a row in a Google Sheet called "Last Seen."
- Check: If the "Last Seen" timestamp is older than 10 minutes, you know n8n is dead.
3. Monitoring RAM and CPU
n8n's performance depends on the Node.js memory limit.
- If you see "Worker died" or "Out of memory" errors in your Docker logs, your workflows are too heavy.
- The Fix: Add more RAM to your VPS or split your workflows into smaller batches (Module 5, Lesson 2).
4. Alerting Paths
Don't rely on n8n to tell you it's broken (it can't!).
- Use an external service (like Checkly or Cronitor) to watch the
/healthzlink. - If the link fails, have that service send you a SMS or an Alert directly.
Exercise: The Vitals Check
- Visit your n8n URL
/healthzin your browser. What does it say? - Setup a free "Uptime" check using an external site.
- Intentionally stop your Docker container. Does the external monitor send you an email within 5 minutes?
- Why is a "Heartbeat" better than just checking if the "Port is open"?
- Research: What is the
N8N_METRICSenvironment variable? (Hint: It's for Prometheus).
Summary
Monitoring is about Peace of Mind. By setting up external health checks and internal heartbeats, you ensure that your automation platform is treated as a "Tier 1" business service that is always alive and ready to serve.
Next Lesson: The Final Step: Documentation inside n8n.