Monitor Django Celery Periodic Tasks
Celery periodic tasks can fail silently in a few different ways — the Celery worker process dies, the Beat scheduler stops, or the broker (Redis/RabbitMQ) connection drops — and none of these show up unless something pings out on success.
Setup
Create an incoming monitor
Add a heartbeat monitor in Pingtastic per periodic task you want monitored, with a grace period a little past the task's schedule interval.
Ping at the end of the task
Add a request to the ping URL at the end of the task function, after the task's actual work completes successfully.
import requests
from celery import shared_task
@shared_task
def send_nightly_report():
# ...existing task logic...
requests.get('https://ping.pingtastic.net/ping/nightly-report', timeout=5)Gotchas
- ⚠A ping at the end of the task function only fires if Celery Beat itself is scheduling runs and a worker is consuming them — if either process is down, or the broker connection has dropped, the task never executes and no ping arrives, which is the correct failure signal.
- ⚠Wrap the ping request so a network hiccup reaching Pingtastic doesn't itself raise and mark an otherwise-successful task as failed — a bare try/except around the requests.get call is enough.
Questions
Does this require a Celery plugin or extra package?
No — a single requests.get() call at the end of the task body is enough, no additional dependency beyond the requests library most Django projects already have.
What if Celery Beat is down but the worker is still running?
If Beat isn't scheduling the task, it never runs and never pings — Pingtastic alerts once the grace period lapses, exactly as intended.
Start monitoring your Django celery tasks
Set up your first monitor in under five minutes.
Get started — $5/month