Blog

7 min read

How to monitor background jobs (queues, workers, and cron)

Background jobs are where reliability quietly breaks. They run out of sight, they fail without anyone watching, and the first symptom is usually downstream — a missing email, stale data, a customer complaint. Here is a practical way to monitor them, whatever runs them.

Why background jobs fail silently

Whether it is a cron entry, a queue worker, or an in-process scheduler, background work shares one trait: nothing is watching it in real time. There is no user waiting on the response, so a failure produces no error page and no angry request — just an absence. Absences are hard to notice.

  • The process that runs the schedule crashed or was scaled to zero.
  • A deploy renamed, moved, or disabled the job.
  • The job threw and the error went to a log file nobody reads.
  • A dependency (Redis, the database, an API) was briefly unavailable.

The pattern that works everywhere: heartbeats

Instead of trying to reach into every runtime, have each job report out when it succeeds. Give the job a unique URL and ping it at the end of a successful run. A monitor that knows the expected interval alerts you when a ping is late or missing — which is the only reliable way to detect a run that never happened.

worker (Node)
async function processJob(data) {
  await doWork(data);
}

// after a successful cycle, check in
await processJob(payload);
await fetch('https://cronmint.com/ping/YOUR-TOKEN').catch(() => {});

Per-job pings vs a liveness ping

For scheduled jobs, ping once per successful run and set the monitor interval to the schedule. For always-on workers with no fixed cadence, add a low-frequency liveness ping (say once a minute) so a dead worker is detected even between jobs. Many real systems use both.

Add retries and flap control

Not every hiccup deserves a 3am alert. Give jobs a small, bounded retry, and only skip the heartbeat when a run genuinely fails. Let your monitor absorb a single missed ping before alerting so one transient blip does not page you, while a job that is actually stuck still does.

Make the alert reach a human

Monitoring that logs to a dashboard nobody opens is not monitoring. Route alerts to email and Slack, include the job name and the last known status, and make sure the person who can fix it is the one who gets pinged.

Never miss a silent cron failure again

Cronmint monitors your scheduled jobs and alerts you the moment one fails — or silently doesn't run. 5 jobs free, no card.

Start free

Frequently asked questions

How do I monitor background jobs?

Have each job ping a unique heartbeat URL when it succeeds, and use a monitor that alerts you when the expected ping is late or missing. This works for cron, queue workers, and in-process schedulers alike.

How do I know a queue worker died?

Add a periodic liveness ping from inside the worker. When the worker dies, the pings stop, and the monitor flags the missing check-in — even if no job errored.

What is the best interval for the monitor?

Match it to how quickly a failure matters. For a scheduled job, use its cadence; for a liveness ping, once a minute is common. Cronmint supports intervals down to one minute on Pro.