API Provider

Cron.health
Cron.health

Developer links

Cron Job Monitoring API
Cron Job Monitoring API

Receive alerts when your cron jobs and scheduled tasks don't run on time. Simple and effective monitoring for your scheduled tasks.

Monitoring cron jobs is as difficult as it is important. Because these tasks usually run on servers that are not accessible from outside HTTP calls, and the only way to get information from them is cron jobs sending logs itself to another service.

The Cron Job Monitoring API does exactly that. Every time your services are running, they report that they are OK or there is a problem, via a ping event to this API. If your service is delayed in sending pings until grace time, Cron Job Monitoring API will notify you immediately by e-mail. It's that simple!

Let's start using it step by step

1. Create a new "check"

We start using the API by creating a new check. Don't forget to give it a beautiful and memorable name. POST /check endpoint will create a new check and give you a unique "ping url" back. The next step should be for your application to start pinging this ping url.

curl --location \
--request POST 'https://api.promptapi.com/cron_monitoring/check' \
--header 'apikey: API KEY' \
--data-raw 'My First Check'

When a new check is created all of it information is returned with the response

{
    "id": "5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b",
    "name": "My First Check",
    "status": "unknown",
    "ping_url": "https://api.promptapi.com/cron_monitoring/p/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b",
    "schedule": {
        "type": "cron",
        "cron_expression": "0 * * * *",
        "grace_time": 60,
        "timezone": "UTC",
        "last_check_at": null,
        "cron_description": "Every hour"
    },
    "integrations": [
        {
            "type": "email",
            "email": "[email protected]",
            "owner": "[email protected]"
        }
    ]
}
2. Pinging the API regularly

Place the following piece of code in your cron jobs that pinging for this check wherever you see fit. You can put as often as you want. It can also happen inside a for loop, only 1 time. It's entirely up to you. The Cron Job Monitoring API will store the last 1000 ping requests for you, and you can get the whole ping list with GET / check / / pings endpoint.

curl --location \
--request POST 'https://api.promptapi.com/cron_monitoring/ping/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b' \
--header 'apikey: API KEY' \
--data-raw 'This is some description'
3. Pinging for special statuses

If you want to notify the API that the application has a problem somewhere, simply add / fail to the end of your ping_url and send it. You can also send / start and / finish status codes. Messages sent with / fail status will intelligently shorten the grace time and allow you to receive earlier alerts if the cron is delayed.

curl --location \
--request POST 'https://api.promptapi.com/cron_monitoring/ping/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b/fail' \
--header 'apikey: API KEY' \
--data-raw 'This is the ping description.'
4. Getting the ping information

You can get the description of your check and how often it will check the service with GET / check / endpoint. Your API will look for any ping at the times specified in the cron expression, then wait for the time specified by grace time. If there is still no ping, it will alert you.

curl --location \
--request GET 'https://api.promptapi.com/cron_monitoring/check/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b' \
--header 'apikey: API KEY'
5. Retrieving the logs for a check

If you want to view all "pings" at once, you can use the GET / pings endpoint.

curl --location \
--request GET 'https://api.promptapi.com/cron_monitoring/check/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b/pings' \
--header 'apikey: API KEY'
6. Settting the crontab expression

By default, your API will set the crontab expression to 0 * * * * once a day. If you want to change this, you can use the PUT / schedule / cron endpoint.

curl --location \
--request PUT 'https://api.promptapi.com/cron_monitoring/check/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b/schedule/cron' \
--header 'apikey: API KEY' \
--data-raw '0 */3 * * *'
7. Updating the grace time

Your API takes grace time 60 minutes by default. If you want to change this value PUT / schedule / grace.

curl --location \
--request PUT 'https://api.promptapi.com/cron_monitoring/check/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b/schedule/grace' \
--header 'apikey: API KEY' \
--data-raw '90'
8. Changing the timezone/

The API will take UTC as the default timezone. If you want to change it, you can use the PUT / schedule / timezone endpoint.

curl --location \
--request PUT 'https://api.promptapi.com/cron_monitoring/check/5dfaf9d0-3a2c-40dd-902e-cc0fb352b86b/schedule/timezone' \
--header 'apikey: API KEY' \
--data-raw 'UTC+04:00'

That is all! This information covers the basics of your API. You can find more details in the API documentation.

How secure is this service?

Prompt API is a legal entity in European Union and regulated by its laws. We never store any sensitive information on our servers and fully respect your privacy.

Is it free?

Cron Job Monitoring API is a paid service but we have a free plan that will be more than enough for you to test its functionalities and see if it works for your needs.

How does Prompt API's pricing work?

Our subscriptions are tiered. We offer a monthly subscription scheme and you decide which tier works for you the best. No strings attached.

Can I cancel/upgrade/downgrade at any time?

Sure you can. You can cancel your subscription or upgrade/downgrade yourself, anytime without any restrictions.

Fast and reliable
Affordable

Ready to try it out?

We offer a free plan. No credit cards required!


or see documentation

See Also

View All