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.

Schedule

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
In the app
Schedule calendar for five monitors in one project. Nightly orders sync missed its 02:30 run, and a run that arrived soon after matches no expected run, so it shows as not expected. Schedule calendar for five monitors in one project. Nightly orders sync missed its 02:30 run, and a run that arrived soon after matches no expected run, so it shows as not expected.

A missed 02:30 run, and a run the schedule never asked for.

Duration

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.

Shell
# 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
In the app
Run durations of an hourly job over the last 24 hours: the median, p95 and average compared with the period before, and one bar per run, colored fast, near limit or above limit against a dashed 3m 30s expected duration line Run durations of an hourly job over the last 24 hours: the median, p95 and average compared with the period before, and one bar per run, colored fast, near limit or above limit against a dashed 3m 30s expected duration line

Every run of an hourly job, colored by how it compares with its expected run duration.

Output

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
Shell
# 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"
History

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
Shell
# tag the run with the build that ran it
curl -fsS -m 10 "$PING?exit_code=$?&version=$GIT_SHA"
Ping URL

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.

Shell
# 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.