Alert Slack the moment a Fly.io Machine goes unhealthy

Every 15 minutes we scan your Fly.io apps and Machines, and the second one goes unhealthy or crashes, your team gets a clear Slack alert.

Agentic Task
Fly.ioSlack BotEngineeringOperationsNotifications & AlertsResearch & Monitoring
PromptCreate

Every 15 minutes, watch my Fly.io infrastructure and alert my team in Slack the moment a Machine goes unhealthy. Run this on a cron schedule that fires every 15 minutes.

First, scan every Machine across my whole Fly.io organization. Use Fly.io List Apps to enumerate my apps, then use List All Machines (the organization-scoped operation) to pull every Machine in one pass, or fall back to List Machines per app if needed. For each Machine, read its current state and its health checks. Note: seeing every app requires an organization-scoped token; an app-scoped deploy token only sees one app.

Decide what is genuinely worth paging on. Flag a Machine when it is stopped unexpectedly, in a failed or error state, or failing one or more of its health checks. Ignore Machines that are intentionally stopped or scaled to zero, so routine idle capacity never triggers a false alarm. For every Machine you judge to be a real problem, call Fly.io Get Machine (or List Events) to pull its most recent events, so you can include the latest event in the alert.

If, and only if, at least one Machine is genuinely unhealthy, post one concise message with the Slack Bot Send a Message operation to my alerts channel (I will specify which channel). Put each affected Machine on its own line with the app name, Machine ID, region, current state, the specific check that is failing, and the latest event. Keep it scannable so an on-call engineer can triage at a glance.

If every Machine is healthy, do not post anything at all. Stay silent so the channel only lights up on real problems.

Additional information

What does this prompt do?
  • Checks every Fly.io app and Machine on a schedule and reads each one's current state and health checks.
  • Flags only the Machines that are genuinely in trouble: crashed, stuck, in an error state, or failing their health checks, while ignoring anything you intentionally stopped or scaled to zero.
  • Posts a single, scannable Slack message naming each affected app, Machine, region, what's wrong, and the latest event so on-call can triage fast.
  • Stays quiet when everything is healthy, so the channel only lights up on real problems.
What do I need to use this?
  • A Fly.io account connected with an organization-wide access token so the workflow can see every app in your org.
  • A Slack workspace with the bot added to the channel where you want alerts to land.
How can I customize it?
  • Change how often the check runs (every 15 minutes by default).
  • Pick which Slack channel the alerts post to.
  • Adjust what counts as worth paging on, for example whether to include staging apps or always ignore Machines you deliberately keep stopped.

Frequently asked questions

Will it wake me up when nothing is actually wrong?
No. It only posts when a Machine is genuinely unhealthy, crashed, or failing its checks. Machines you intentionally stopped or scaled to zero are ignored, and when everything is healthy the channel stays silent.
How quickly will I hear about a problem?
The check runs every 15 minutes by default, so you'll typically know within a few minutes of a Machine going unhealthy. You can make it run more or less often.
Does it cover all of my apps or just one?
It scans every app in your Fly.io organization along with all of their Machines, as long as you connect an organization-wide access token. An app-scoped token would only see a single app.
What details are in each alert?
Every alert lists the affected app, the Machine, its region, its current state, the check that's failing, and the most recent event, so you can jump straight into fixing it.
Can it post to a private channel?
Yes. Just add the bot to the channel you want alerts to go to, whether it's public or private.

Stop hearing about Fly.io outages from your users first.

Put a watchful eye on every Machine and let your team hear about real problems in Slack the moment they start.