Healthchecks recently gained a new feature: check auto-provisioning. When you send a ping request to a slug URL, and a check with the specified slug does not exist, Healthchecks can now automatically create the missing check. This feature requires opt-in: to use it, add a ?create=1
query parameter to the ping URL.
Here’s check auto-provisioning in action (the -I
parameter tells curl to send HTTP HEAD requests so that we can see HTTP response status codes easily):
$ curl -I https://hc-ping.com/fixme-ping-key/does-not-exist
HTTP/2 404
[...]
$ curl -I https://hc-ping.com/fixme-ping-key/does-not-exist?create=1
HTTP/2 201
[...]
$ curl -I https://hc-ping.com/fixme-ping-key/does-not-exist?create=1
HTTP/2 200
[...]
- The first request returns HTTP 404 (“Not Found”) because a check with a slug
does-not-exist
does, in fact, not yet exist. - The second request has a “?create=1” added to the URL to enable auto-provisioning. The server creates a new check and returns HTTP 201 (“Created”).
- The third request is the same as the second, but a matching check now exists. The server accepts the ping and returns HTTP 200 (“OK”).
When is this useful? Whenever you are working with a dynamic infrastructure, and want your monitoring clients to be able to register with Healthchecks.io automatically. If you distribute the Ping Key to monitoring clients, each client can pick its own slug (for example, derived from the server’s hostname), construct a ping URL (https://hc-ping.com/<ping-key>/<slug-chosen-by-client>?create=1
), and Healthchecks.io will auto-create a new check on the first ping.
Auto-Provisioned Checks Use Default Configuration
With the current auto-provisioning implementation, clients can create new checks on the fly, but they cannot yet specify the period, the grace time, the enabled integrations, or any other parameters. The new checks will be created with default parameters (period = 1 day, grace time = 1 hour, all integrations enabled). If you need to change any parameters, you will need to do this either manually from the web dashboard, or from a script that calls Management API.
Auto-Provisioning and Account Limits
Each account has a specific limit of how many checks it is allowed to create: 20 checks for free accounts; 100 or 1000 checks for paid accounts. To reduce friction and the risk of silent failures, the auto-provisioning functionality is allowed to temporarily exceed the account’s check limit up to two times. Meaning, if your account is already maxed out, auto-provisioning will still be able to create new checks until you hit two times the limit. If your account goes over the limit, you will start to see warnings in the dashboard and email:
As soon as you get the number of checks in your account below the limit (either by upgrading to higher limits, or by removing unneeded checks), the warning will go away. If you do not resolve the warning for more than a month, you will start seeing an “Account marked for deletion” notice in the dashboard. After another month of inaction, the account will be deleted.
Slugs and Names Are Now Separate
In the initial slug implementation check slugs were tied to check names. Changing a check’s name also updated its slug. With the introduction of auto-provisioning, check names and slugs are now decoupled. You can hand-pick a custom slug for each check. You can also rename a check but keep its existing slug.
The “Name and Tags” dialog has gained a new, editable “Slug” field:
Similarly, the Create a Check and Update an Existing Check API calls now support a new slug
field.
Happy monitoring,
–Pēteris