Daily backup compliance check for ClickHouse Cloud
Every morning, check each ClickHouse service against its own backup schedule, get a Slack summary, and a Linear ticket for anything stale or failed.
Every morning at 7am, check backup health across all of my ClickHouse Cloud services and flag any that are out of compliance with their own backup schedule. Use a cron trigger on a daily timer. The ClickHouse Cloud management API does not send webhooks and is not a poll provider, so a scheduled run is the right way to do this.
First, call List Services to get every ClickHouse Cloud service in my organization. Then, for each service, pull its backups with List Service Backups, which returns them most recent first with a status on each one, and read its schedule with Get Service Backup Configuration to learn the configured backup interval and retention for that service.
For each service, decide whether it is out of compliance. Treat a service as non-compliant when the most recent successful backup is older than that service's configured backup interval, when there is no backup at all, or when the most recent backup is in a failed state. Judge staleness relative to each service's own configured interval, never a fixed number of hours, because each service can have a different schedule and retention. Identify the newest backup whose status indicates success, treat that as the last good backup, and compute its age from its timestamp.
Post a single summary to the #data-ops Slack channel using the Slack Bot Send a Message action. List every service with its compliance status, the age of its last good backup, and its configured schedule, and call out the non-compliant services clearly at the top. Write it as a readable Slack message using Slack formatting, not raw JSON.
For every non-compliant service, open a Linear issue with Create Issue that names the service, the age of its last good backup, the configured backup schedule, and what is wrong (stale, missing, or failed). Before creating anything, dedupe by a stable per-service title such as 'ClickHouse backup out of compliance: <service name>'. Use Search Issues to look for an existing open issue with that title, and only create a new one if none exists, so a persistent problem does not spawn a fresh ticket every day. If a matching open issue already exists, leave the existing ticket in place instead of creating a duplicate.
Additional information
What does this prompt do?
- Checks the backups for every one of your ClickHouse Cloud services first thing each morning.
- Judges each service against its own backup schedule, so 'stale' means late for that service, not some fixed number of hours.
- Posts a single backup-health summary to your #data-ops Slack channel, covering healthy and unhealthy services alike.
- Opens a Linear ticket for each service that is overdue, missing a backup, or whose last backup failed, and avoids filing a duplicate ticket for a problem that is already tracked.
What do I need to use this?
- A ClickHouse Cloud account with an API key that can read your services and their backups.
- A Slack workspace with our bot added to the channel where you want the summary posted.
- A Linear workspace where tickets can be created.
How can I customize it?
- Change the time it runs (7am by default) or how often it checks.
- Point the daily summary at a different Slack channel.
- Adjust which backup states count as a problem, or which Linear team and priority new tickets use.
Frequently asked questions
How does it decide a backup is 'stale'?
Will it spam Linear with a new ticket every day for the same problem?
What counts as out of compliance?
Does everyone get pinged, or only when something is wrong?
Can I use a different chat tool or issue tracker?
Related templates
Never get surprised by a stale ClickHouse backup again.
Set up an automated morning check that watches every ClickHouse Cloud service against its own schedule and turns overdue backups into tracked tickets.