Heartbeat Monitors

This is a reverse monitor. Instead of performing a check on your service, we wait for your service to check in on us. The monitor status changes if the scheduled check is late, beyond a configured window.

Specifically, we provide you with a webhook, and expect to receive a request to that URL according to the schedule you set.

The timer does not start until the first time the webhook is called, to allow you to incorporate this logic at your leisure.

For a reference guide to monitoring settings, see this page.

Uses

This type of monitor is typically used to verify that a background task is operating correctly.

We can alert you if the webhook is not called within a certain timeframe (as configured). This would indicate that something has gone wrong with the task, as otherwise it would have checked in.

This monitor type is often used alongside a crontab schedule, with the crontab expression matching that of the monitored task.

Webhook

Your service will need to send an HTTP request to a specific URL, which is listed on the dashboard and follows the format (where <TOKEN> is replaced with the appropriate value for the relevant monitor):

https://api.statuscloud.com/heartbeat/<TOKEN>

For example, if your token was ABC123, you should send a request to:

https://api.statuscloud.com/heartbeat/ABC123

The value of the token is case-sensitive.

https://api.statuscloud.com/heartbeat/abc123 would not work here.

This endpoint accepts any GET, POST, or HEAD request, and does not require any authentication, body, or headers (other than those already required to deliver the request, such as the Host header).

You must use the HTTPS protocol (as given in the URL).

If successful, the endpoint returns 204 No Content. Otherwise, an appropriate error status is given (usually 404 Not Found, indicating an incorrect token value).

There are a number of ways to incorporate this HTTP request into your existing system.

Most programming languages include relevant methods as part of their standard library, or these are available as packages. Alternatively, send a curl request. For example:

$ curl https://api.statuscloud.com/heartbeat/ABC123

Make sure to only send this request after your task has succeeded, typically at the end of the code. Otherwise, we will not be able to detect if it fails.

Last updated on Saturday 27th August 2022