Monitor Render and Heroku cron jobs
Platform cron jobs run a command on a schedule and keep the logs for a while. Nobody reads those logs until something breaks. A heartbeat check tells you sooner: the command reports to Pingstack after it succeeds, and Pingstack alerts you when that report doesn’t arrive on time.
1. Create a heartbeat check that matches the schedule
Section titled “1. Create a heartbeat check that matches the schedule”Both platforms run schedules in UTC, so choose UTC in Pingstack. See schedules and timezones.
- Render: a cron job has a standard cron schedule, such as
0 2 * * *. Use the same expression. - Heroku Scheduler: jobs run every 10 minutes, every hour, or daily at a
time you pick. Use an Interval of 10 minutes, cron
M * * * *for the hourly minute it shows, or cron for the daily time (for example30 2 * * *).
Create a heartbeat check with that schedule and a grace period longer than the job’s runtime. Heroku describes its Scheduler as best-effort and can occasionally skip or delay a run; a generous grace period avoids alerts for small delays, and a skipped run is worth knowing about. Attach a notification group.
2. Store the ping URL as an environment variable
Section titled “2. Store the ping URL as an environment variable”Copy the location’s ping URL from the check in Pingstack.
- Render: add
PINGSTACK_PING_URLunder the cron job’s Environment. - Heroku: add it as a config var. To keep it out of your shell history, use the app’s Settings › Config Vars in the dashboard.
3. Report after the command succeeds
Section titled “3. Report after the command succeeds”Chain the report onto the job’s command:
./bin/nightly-report && curl --fail --silent --show-error --max-time 10 --retry 3 "$PINGSTACK_PING_URL"- Render: use this as the cron job’s Command.
- Heroku Scheduler: use it as the job’s Run Command.
&& runs the report only if the job exits successfully, so a failed run sends
nothing and Pingstack alerts you when the deadline passes. If you’d rather
report from inside your program, call the ping URL at the end, after the work
succeeds.
4. Confirm the first report
Section titled “4. Confirm the first report”- Render: open the cron job and choose Trigger Run.
- Heroku: run the same command once with
heroku run.
Open the check in Pingstack and confirm the location received a heartbeat and shows a next deadline.
Optional: report a number
Section titled “Optional: report a number”Add --get --data-urlencode "value=$COUNT" to the curl call with a count the
job produces to send it as a
numeric value. Then set
warning and critical thresholds on the check.
Why a healthy job might still alert
Section titled “Why a healthy job might still alert”- Heroku best-effort scheduling. Occasionally a run is late or skipped. If that’s frequent and matters, move the job to a dedicated scheduler.
- Long runs. A job that runs longer than its interval can be stopped or skipped by the platform. Either way, it stops reporting on time.
- Build failures. A failed deploy can leave a Render cron job on an old build, or without one. Check the latest deploy.
If alerts still don’t match what you expect, see troubleshooting monitoring.