Monitoring Modes
Drumbeats has two monitoring modes — scheduled (cron / heartbeat) for predictable timetables and event-driven for jobs that run on demand.
Drumbeats has two monitoring modes that cover almost every background-job shape: scheduled (predictable timetable — cron and heartbeat) and event-driven (on-demand — queue workers, webhook handlers, CI jobs). Pick scheduled when Drumbeats should detect a late or missed run automatically. Pick event-driven when runs are unpredictable but you still care about duration and explicit success / failure.
For the per-type picker with examples see Monitor types; for the HTTP patterns each mode uses see Ping API.
Scheduled jobs
Best for nightly backups, weekly reports, hourly syncs, ETL windows — anything with a deterministic schedule.
- You configure — a cron schedule (or a Heartbeat interval like
5m,1h) plus a grace period. - Drumbeats expects — a
successping byexpected_time + grace_period_seconds. Optionally astartping too, for duration tracking. - Drumbeats alerts on — a missed window (no ping by
expected_time + grace_period) or an explicitfailureping.
How to configure a scheduled monitor
- Choose Cron or Heartbeat when creating the monitor.
- Enter the cron expression (
0 0 *for midnight daily) or the interval (5m). - Set a grace period (
grace_period_seconds) — the buffer Drumbeats waits pastexpected_timebefore declaring the run missed. Default300seconds. - Send
success(andfailureif needed) when the job ends.
Example — nightly backup
# Cron entry: 0 0 * * *
/usr/bin/backup.sh \
&& curl https://api.drumbeats.io/v1/ping/<monitor-id>/success \
|| curl https://api.drumbeats.io/v1/ping/<monitor-id>/failure# Cron entry: 0 0 * * *
/usr/bin/backup.sh \
&& curl https://api.drumbeats.io/v1/ping/<monitor-id>/success \
|| curl https://api.drumbeats.io/v1/ping/<monitor-id>/failureSee Scheduled pings for the recommended start + success/failure shape and progress-log patterns.
Event-driven jobs
Best for queue workers, CI pipelines, user-triggered tasks, webhook handlers, data imports — anything that runs on demand rather than on a clock.
- You configure — a
max_duration_secondsceiling that represents "this job should finish by …". - Drumbeats expects — a
startping with a uniquerun_idat the top, thensuccessorfailurewith the samerun_idat the end. - Drumbeats alerts on — a
startthat never finishes (hung run, treated as failure) or an explicitfailureping.
How to configure an event-driven monitor
- Choose Event-driven when creating the monitor.
- Set
max_duration_secondsto your tolerable upper bound. - Send
startwith a uniquerun_id, thensuccessorfailurewith the samerun_id.
Example — queue worker
RUN_ID="job-$(date +%s)-$$"
curl "https://api.drumbeats.io/v1/ping/<monitor-id>/start?run_id=$RUN_ID"
node process-message.js
EXIT=$?
if [ $EXIT -eq 0 ]; then
curl "https://api.drumbeats.io/v1/ping/<monitor-id>/success?run_id=$RUN_ID"
else
curl "https://api.drumbeats.io/v1/ping/<monitor-id>/failure?run_id=$RUN_ID"
fiRUN_ID="job-$(date +%s)-$$"
curl "https://api.drumbeats.io/v1/ping/<monitor-id>/start?run_id=$RUN_ID"
node process-message.js
EXIT=$?
if [ $EXIT -eq 0 ]; then
curl "https://api.drumbeats.io/v1/ping/<monitor-id>/success?run_id=$RUN_ID"
else
curl "https://api.drumbeats.io/v1/ping/<monitor-id>/failure?run_id=$RUN_ID"
fiSee Event-driven pings for run_id strategies and language-specific examples in Node.js, Python, Go, and PHP.
Picking the right mode
- Choose scheduled when you know exactly when runs should happen — Drumbeats does the missed-window detection for you.
- Choose event-driven when runs are unpredictable but you still want duration tracking and concurrency-safe correlation via
run_id. - Mix both freely — each monitor is independent. A typical project has cron monitors for nightly tasks and event-driven monitors for the queue workers.
Related guides
- Monitor types — the four monitor types (Cron, Heartbeat, Event-driven, Uptime) and what each does with these modes.
- Cron monitors and Heartbeat monitors — the scheduled variants.
- Event-driven monitors — the on-demand variant.
- Ping events — the four event names both modes use.
- Alert logic — how tolerances and grace periods turn into actual alerts.