Cron job monitoring documentation

Our cron job monitoring uses an industry-standard way of monitoring the health of your scheduled tasks. We use a callback URL, sometimes called a heartbeat or pingback.

When you create a cron job definition in Oh Dear, you will be given a unique URL specific to that cron job.

You can then modify your cron job in your code or on your servers, to do a quick network fetch to that unique URL. If we receive that pingback on time, we know the cron job was executed correctly.

If we don't receive a hit on that unique URL, we know the cron job hasn't been executed, and we can alert you.

Amount of cron jobs to monitor

Per website in your subscription package, you have a quota of 5 cron jobs you can monitor.

For instance: if you are currently on the 10-site plan, you will have a total quota of 50 cron jobs you can monitor.

You are free to use those any way you like, you can add 45 cron jobs to a single site and the remaining 5 cron jobs to another one. To monitor more cron jobs, you can upgrade your subscription.

Simple cron job monitoring

By default, we have the option to do simple cron job monitoring.

For simple cron job monitoring, you would only need to provide the frequency. In other words, how often does this cron job run on your systems?

This would be set to the exact frequency the scheduled tasks are executed. If a cron job runs every five minutes, you would set the frequency to 5.

Cron expression monitoring

An alternative to the simple cron job monitoring is the method where you define a crontab schedule instead.

To use this, you can enter the exact crontab syntax you would find on your servers. For instance, for cron expression type monitoring, you could enter the following:

  • * * * * *: this would run every minute
  • */5 * * * *: this would run every five minutes
  • 0 */4 * * *: this would run every 4 hours
  • 0 10 1 * *: this would run at 10AM on the first day of each month

While the syntax is more arcane (it's default crontab syntax), it allows you to copy/paste directly from your crontab.

Server Timezone

If you're using the cron expression to define your cron job monitors, we need to know the timezone of your server. It's that timezone that determines when the scheduled tasks will be executed.

Not sure what timezone your server is configured in? You can find out here.

Grace time

What's the grace time in cron job monitoring? It defines how much time should we allow for a pingback to be received.

To understand this option better, consider the following example.

  1. You have a cron job that runs every 5 minutes.
  2. Sometimes, the cron job finishes in a matter of seconds. Sometimes it takes a few minutes to complete, as it has to import data or calculate results.

Because the cron job is executed every five minutes, the frequency option would be set to 5.

Because there's a variable execution time in the cron job, we want to allow a bit more time for the cron job to actually finish and report back to us. If you know the job itself should not take more than two minutes to complete, you could set the grace time to 3 - slightly higher than your maximum execution time.

This gives us a little more wiggle room before we send out a notification.

In this example, if the cronjob isn't executed, we will wait for 3 more minutes before we send the notifications. If we receive the ping that the cron was executed during that grace time, we won't send any notifications.

Implementing the Ping URL in your application

In order to use your cron job monitoring, your application should be configured to make an HTTP call to the Ping URL whenever the job is completed. Here are some ways you could implement this.

We have example code available for:

We have support for even more advanced options, like providing runtime duration and memory usage or failure states. Have a look at at the advanced options & parameters to see what's possible.

Was this page helpful to you? Feel free to reach out via or on Twitter via @OhDearApp if you have any other questions. We'd love to help!