Quick Answer
To alert on cron job failures, define what "failed" means (non-2xx response, missing body match, timeout), set a consecutive-failure threshold (typically 3–5), then point a notify-webhook URL at your Slack / PagerDuty / Discord incoming-webhook. On Requex.me this is built in — no separate uptime service needed.
Cron Job Failure Alerts — Slack, PagerDuty, Discord
A cron that fails silently is worse than one that doesn't run at all. This guide shows you how to detect failures correctly and route alerts to the channel your team actually watches.
Step 1: Define What "Failed" Means
A 200 response is not always a success. A 200 with body {"error":"db timeout"} means the endpoint answered but the work didn't happen. Define your failure criteria along three axes:
- Expected status code — usually 200 or 204. Anything else is a failure.
- Expected body match — a substring the response must contain (e.g.
"ok"). Catches the "200 with error JSON" case. - Timeout — if the request hangs longer than expected, the run is failed regardless of response.
Step 2: Pick a Consecutive-Failure Threshold
Single failures are noise — a network blip, a transient 502 from the target. Multiple consecutive failures are signal. The right threshold depends on cadence:
| Job cadence | Recommended threshold | Why |
|---|---|---|
| Every minute | 5 failures | 5 min outage threshold; avoids flapping |
| Every 5 min | 3 failures | 15 min outage; matches typical SLO |
| Hourly | 2 failures | 2 hour gap is already meaningful |
| Daily / weekly | 1 failure | Alert on the very first miss |
Step 3: Route the Alert
Requex's notify-webhook field accepts any HTTPS URL. The notification POST contains job ID, name, last status code, last error, and timestamp — your downstream service formats and routes.
Slack
- Slack → Apps → Incoming Webhooks → Add to Slack → choose channel.
- Copy the
https://hooks.slack.com/services/...URL. - Paste into Requex cron job's Notify webhook URL field. Slack will render the payload as a basic message; for richer formatting put a small relay in front.
PagerDuty
- PagerDuty → Services → choose service → Integrations → add "Events API V2".
- Use the integration URL as your notify-webhook (format the payload via a small relay or use a Requex workflow to shape it into Events API v2 JSON).
Discord
- Discord channel → Settings → Integrations → Webhooks → New Webhook → copy URL.
- Paste into Requex notify-webhook. Discord renders the JSON inline — fine for alerts.
Step 4: Test the Alert Before You Need It
Temporarily point your cron job at a URL that returns 500 (Requex's response config can simulate this), wait for the threshold, and confirm the alert reaches the channel. Don't discover at 3 AM that your Slack webhook URL was rotated three months ago.
Related Resources
Set Up Cron Alerts in 60 Seconds
Free cron monitoring with built-in failure alerts.
Open Requex.me →