How to Monitor Cron Jobs and Scheduled Python Scripts
Python powers a huge share of scheduled work — ETL pipelines, scraping, ML retraining, report exports. However you schedule it, the failure mode is the same: when it stops, it stops quietly. A heartbeat ping fixes that.
Plain cron + curl
The simplest approach pings after the script exits successfully:
0 * * * * /usr/bin/python3 /app/etl.py && curl -fsS https://api.cronguard.dev/v1/ping/<your-uuid>Pinging from inside Python
For start/success/failure signalling, ping directly from the script. Using requests:
import requests
BASE = "https://api.cronguard.dev/v1/ping/<your-uuid>"
def ping(suffix=""):
try:
requests.get(BASE + suffix, timeout=10)
except requests.RequestException:
pass # never let monitoring break the job
def main():
ping("/start")
try:
run_etl()
ping() # success
except Exception:
ping("/fail")
raise
if __name__ == "__main__":
main()APScheduler
Wrap the job, or add a listener that pings on success and failure events:
from apscheduler.events import EVENT_JOB_EXECUTED, EVENT_JOB_ERROR
import requests
BASE = "https://api.cronguard.dev/v1/ping/<your-uuid>"
def on_event(event):
suffix = "/fail" if event.exception else ""
try:
requests.get(BASE + suffix, timeout=10)
except requests.RequestException:
pass
scheduler.add_listener(on_event, EVENT_JOB_EXECUTED | EVENT_JOB_ERROR)Celery beat
For a periodic Celery task, ping at the end of the task body — or use task_success / task_failure signals to ping centrally for all periodic tasks.
Alerts that reach you
Send those pings to CronGuard and define how often each job should check in. If a Python job misses its window — crash, hang, broken schedule or dead host — CronGuard alerts you instantly across multiple channels and tracks how long each run takes. Free to start, no credit card.
Stop losing sleep over silent failures
CronGuard alerts you within minutes when a scheduled job fails to check in. No agent to install. Free to start.
Start Monitoring Free