MongoDB and Slack: Stuck Job Queue Backlog Alert Template

A scheduled Spojit workflow that counts pending and stalled jobs in a MongoDB queue collection and alerts Slack the moment your backlog or oldest-job age crosses a limit.

What It Builds

A Schedule trigger runs every few minutes and a MongoDB Connector node queries your queue collection for pending and stalled jobs, returning the backlog count and the age of the oldest waiting job. A Condition node compares those numbers to your thresholds, and when either is exceeded a Slack Connector node posts an alert to your ops channel. Quiet runs finish silently, so you only hear about real backlogs.

The Prompt

Paste this into Miraxa and it builds the workflow, connecting the tools for you:

Every 5 minutes, query my MongoDB jobs collection for documents where status is "pending" or "processing", count them, and find the oldest job's createdAt timestamp. If the count is over 100 or the oldest job is more than 15 minutes old, post a message to the #ops Slack channel with the backlog count and the oldest-job age.

Connectors Used

  • Schedule trigger - runs the check on a fixed interval using a cron expression and your timezone.
  • MongoDB - counts pending and stalled jobs and reads the oldest timestamp.
  • Slack - posts the backlog alert to your chosen channel.

Customize It

Change the interval, the collection name, and the status values to match your queue. Adjust the count threshold (100) and the age threshold (15 minutes), swap #ops for your channel, and add fields like the oldest job's id or type to the Slack message so on-call engineers can jump straight to the stuck record.

Tips

  • Give the MongoDB connection read access to the queue database; a read-only role is enough for this check.
  • Keep the MongoDB and Slack nodes in Direct mode for a deterministic, no-AI-cost run on every interval.
  • Set the interval a little wider than your normal job duration so healthy backlogs clearing on their own do not page you.

Related

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.