Healthchecks now supports OnCalendar schedules, used for scheduling tasks with systemd timers. Here’s what’s new: when creating a check, you can now switch between “Simple”, “Cron” and “OnCalendar” schedules:
You can also edit schedules (and switch schedule types) for existing checks:
The UI control for entering the schedule is a multi-line textbox, and yes, you can specify multiple schedules there – Healthchecks will expect a ping when any schedule matches:
Note: the schedule field is currently limited to 100 characters. You will be able to enter 2-3 schedules, but probably not 10+ schedules.
systemd allows you to specify a timezone inside the OnCalendar expression. So does Healthchecks:
The API now supports OnCalendar schedules as well. You can pass either cron schedule or OnCalendar expression(s) in the “schedule” field for the Create a new check and Update an existing check calls, and Healthchecks will detect the schedule type automatically:
$ curl -s https://healthchecks.io/api/v3/checks/ \
--header "X-Api-Key: fdYYw32ftDvYQoCe4C1JUgp7SlPbOYTI" \
--data '{"name": "Runs at 8AM", "schedule": "8:00"}' | jq .
{
"name": "Runs at 8AM",
"slug": "",
"tags": "",
"desc": "",
"grace": 3600,
"n_pings": 0,
"status": "new",
"started": false,
"last_ping": null,
"next_ping": null,
"manual_resume": false,
"methods": "",
"subject": "",
"subject_fail": "",
"start_kw": "",
"success_kw": "",
"failure_kw": "",
"filter_subject": false,
"filter_body": false,
"ping_url": "https://hc-ping.com/97f70e1c-bf2b-4244-ba44-de413c93fab4",
"update_url": "https://healthchecks.io/api/v3/checks/97f70e1c-bf2b-4244-ba44-de413c93fab4",
"pause_url": "https://healthchecks.io/api/v3/checks/97f70e1c-bf2b-4244-ba44-de413c93fab4/pause",
"resume_url": "https://healthchecks.io/api/v3/checks/97f70e1c-bf2b-4244-ba44-de413c93fab4/resume",
"channels": "",
"schedule": "8:00",
"tz": "UTC"
}
Under the hood, the OnCalendar schedule parsing logic is implemented in a separate “oncalendar” library. Feel free to use it in your own Python projects as well!
The OnCalendar schedule support is live on https://healthchecks.io and available to all accounts. Happy monitoring!
–Pēteris