Q: How do I monitor cron jobs and background tasks that have no URL to ping?
A: Uptime tools watch things that respond. A cron job is the opposite problem, you need to know when it DIDN'T run. Use heartbeat monitoring.
— Set up a heartbeat (dead-man's-switch) monitor. Your job pings a unique URL when it finishes successfully.
— Tell the monitor the expected period plus grace time (e.g. 'every 60 min, alert if no ping in 75').
— Put the ping at the END of the job, after the work succeeds, not at the start.
— On failure, have the job ping a separate fail URL so you distinguish 'didn't run' from 'ran and errored'.
— Add the job's last-run timestamp to a dashboard so silence is visible.
Follow-up: monitor backups this exact way. The worst time to discover backups stopped silently is the day you need to restore.
Got a question? Drop it in the comments.
Pingback Clinic
@PingbackClinic
Q: How do I monitor cron jobs and background tasks that have no URL to ping?
Этот пост опубликован в Telegram-канале Pingback Clinic. Подписаться можно по ссылке: @PingbackClinic.