Cron job monitoring that knows when each job is due
The cron job monitoring features in 1Monitor start with one ping from the job. A missed run, a failed run and a run that takes too long each open an alert. Every run is kept with its duration and output, so you can see a job getting slower before it overlaps its next run.
Hear about the job that did not run
Your backup runs at 03:00 every night. The night the server reboots and cron never starts it, nothing writes an error, because a job that did not run has nothing to log.
Give the job a monitor with the same schedule and it knows a ping is due at 03:00. Allow a 15-minute grace period, and a missing ping opens an alert at 03:15. The alert resolves when the job next completes. This pattern is also called heartbeat monitoring.
- An expected interval, or a time-based schedule picked as weekdays and a time or pasted as a cron expression
- Several schedules on one monitor, such as Mondays at 03:00 and Thursdays at 22:00
- A timezone per monitor, with daylight saving time handled the way your crontab handles it
- A grace period for how late a run may be
- An unexpected-run alert when a run starts while the previous one is still going, or at a time the schedule never asked for, on Standard and higher plans
A missed 02:30 run, and a run the schedule never asked for.
See a job getting slower before it fails
The hourly report takes longer each run, because one table keeps growing. It has never failed, so nothing has told you. One day it will still be running when its next run starts.
Send a start ping when the job begins and a success or fail ping when it ends, and each run gets an outcome and a duration. The run history shows the report getting slower long before it hits a timeout. Set an expected run duration on the monitor, and a run-duration alert opens once runs keep taking longer than that.
- Median and p95 duration for any range, compared with the period before it
- An expected run duration suggested from your run history
- A run-duration alert that opens when 5 of the last 5 runs are slow. On Standard and higher plans, you choose how many of how many runs.
- Click a slow bar to list the runs behind it
# a start ping and an end ping record the run
curl -fsS $PING/start
./nightly-report.sh \
&& curl -fsS $PING/success \
|| curl -fsS $PING/fail
Every run of an hourly job, colored by how it compares with its expected run duration.
Read why it failed in the alert
The backup exits with code 1 at 03:04. An alert that only says “failed” sends you to the server to find out why, and the reason is in what the job printed.
Pipe the job’s output into the ping and pass its exit code, as pinging from the shell shows. The alert includes the output of the failed run, so you know what broke before you open a terminal. We keep the first 10 KB of it, and values that look like credentials are redacted before storage.
- Output checks that fail a run on what it printed, even after a success ping, on Standard and higher plans (setting one up)
- A failed-run tolerance for jobs that may fail once and succeed on the next run, on Standard and higher plans
- The PHP SDK for jobs written in PHP
# send the output and the exit code with the ping
out=$(./backup.sh 2>&1); code=$?
curl -fsS -m 10 --data-binary "$out" \
"$PING?exit_code=$code"
See which deploy broke the job
The import stops importing, and you need to know whether your own release or a change at the source caused it. The run history alone does not say which release the job was running.
Add ?version= to a ping with a commit SHA, a release tag or a build number. Each deploy is then marked on the run history, the run-duration chart and the state timeline. An alert that opens shortly after a deploy names the version the job started failing on, in the app and in every notification.
- Every run’s outcome and duration, kept for your plan’s ping retention. The job’s output is kept for the last 25 runs on Free and for every run within that retention on paid plans.
- Deploy markers on every plan, sent with the version on any ping
# tag the run with the build that ran it
curl -fsS -m 10 "$PING?exit_code=$?&version=$GIT_SHA"
Count only the job’s own pings
A ping URL ends up in a shell history, a CI log or a teammate’s script. A stray request to it would look like a healthy run while the real job has stopped.
Each monitor has its own ping URL, and curl is enough to call it. You do not install an agent or open inbound access to your server. Add ping constraints to require an HTTP method or specific headers. A ping that does not meet them is recorded but never counts toward the monitor’s health.
- Required headers, where a header without a value only has to be present
- What to do when a ping URL leaks
# a monitor that requires POST and a deploy key
curl -fsS -m 10 -X POST \
-H "X-Deploy-Key: secret" \
"$PING"
When the alert opens
Every alert above goes to the monitor’s notification channels. A missed-ping or failed-run alert keeps reminding them until someone acknowledges it. Alerting covers acknowledgment, escalation, snooze, maintenance windows and the alert timeline. To see the setup end to end, read how cron job monitoring works.