The question: if your monitoring runs on the same machine it is watching, what tells you when that machine goes down? I have an answer, but I would like to compare it with yours.
My monitoring container lives on the Proxmox tower. It watches everything in the basement and mails me when something looks wrong. That works until the tower loses power or the hypervisor hangs. Then the monitor goes down with the patient, and the silence looks exactly like a quiet day. It's a smoke detector wired to the same breaker as the stove.
The fix is old and boring. Something outside the failure domain has to expect to hear from the monitor, and complain when it doesn't. Call it a heartbeat or a dead man's switch. I see two ways to do it:
- The monitor sends a small check-in every few minutes to an outside endpoint, and that endpoint alerts you when the check-ins stop. The cost is a third party you have to trust, and a false alarm whenever your own internet line drops. Though I would want to know about that anyway.
- A second small machine, on a different circuit if you can manage it, pings the first and sends the alert. The cost is one more box to patch and label, which is the kind of upkeep I am trying to avoid.
The check-in for option 1 is one line in cron. The URL here is a placeholder:
*/5 * * * * curl -fsS -m 10 --retry 2 https://heartbeat.example.net/your-id > /dev/null
I lean toward option 2, but I haven't settled. And check the alert path itself. If the mail relay runs on the same host, you have rebuilt the same problem with one more step.
When you test this, pull the power cord on a Saturday morning and time how long the alert takes to reach you. Write the number down.
What do you use to watch the watcher? And how do you handle the false alarms when it's the line that is down, not the server?
Dwayne