How do you know a scheduled job actually ran, not just that it did not report failure?
IntermediateScenarioScenarios: health checks, monitoring and alerts
Answer
Situation read → Failure alerts do not fire if the job never starts (timer disabled, host down, cron syntax error).
What I'd do →
- Add a dead man's switch: the job pings a heartbeat URL on success (Healthchecks.io, Cronitor, or an internal endpoint), and the monitor alerts when pings stop:
trap 'curl -fsS -m 10 --retry 3 "$HEARTBEAT_URL/fail" >/dev/null || true' ERR ... curl -fsS -m 10 --retry 3 "$HEARTBEAT_URL" >/dev/null || true - Or check freshness of the job's output: newest backup in S3 younger than 26 hours.
- Export a "last success" timestamp metric (node_exporter textfile collector) and alert on
time() - last_success > 90000.
Why → Monitoring absence of success catches every failure mode, including ones you did not think of.
Interview tip → Say "alert on missing success, not only on reported failure".
More on Scenarios: health checks, monitoring and alerts
You are asked for a host health-check script covering disk, memory, systemd services and an HTTP endpoint. How do you design it?IntermediateYour disk alert fires and clears every few minutes around 80%, spamming Slack. How do you fix the alerting?AdvancedA server reports `No space left on device` but `df -h` shows 40% free. What would you add to the health checks?BeginnerAlert when any certificate under `/etc/letsencrypt/live` expires within 21 days.IntermediateA developer wrote a Bash loop that restarts the app whenever its process disappears. What do you suggest instead?IntermediateYou suspect a memory leak in a service. How do you collect evidence with a script before involving developers?Advanced