How to Monitor Your Fly.io Application with Vigilmon
Fly.io runs your Docker containers close to users in 35+ regions worldwide. But running close to users doesn't mean you don't need external monitoring — a Fly machine that crashes, a misconfigured health check, or a scaling policy gone wrong can take your app down. Vigilmon monitors your Fly.io deployment from outside the Fly.io network.
Why Monitor Fly.io Apps Externally?
Fly.io provides internal health checks and restart policies, but internal monitoring has blind spots:
- Anycast routing failure — traffic stops reaching your machines even though they're running
- TLS certificate issues — your custom domain's cert expired
- Scale-to-zero cold start — machines not starting fast enough, causing timeout errors
- Region-specific failure — machines in one region are down, others fine
- Dependency outage — your app is running but its database or API dependency is down
Vigilmon checks from multiple regions, so you catch asymmetric failures Fly's internal monitoring misses.
Setting Up Monitoring for Your Fly.io App
1. Main Application URL
https://your-app.fly.dev
or your custom domain:
https://yourproduct.com
Vigilmon setup:
- URL: your app's public URL
- Expected status:
200(or301/302if it redirects to HTTPS) - Keyword check: add a string from your homepage to verify content loads
- Interval: 2–5 minutes
- Multi-region: enable checks from US, EU, and AP
2. Health Check Endpoint
Add a /health or /healthz endpoint to your app:
// Express.js example
app.get('/health', (req, res) => {
res.json({ status: 'ok', timestamp: Date.now() });
});
# FastAPI example
@app.get("/health")
def health():
return {"status": "ok"}
This endpoint can do lightweight checks (DB connection ping, cache availability) without running full business logic.
Monitor it separately:
- URL:
https://your-app.fly.dev/health - Keyword:
"ok" - Interval: 2 minutes
3. Fly.io API Monitor (App Status)
Fly exposes a GraphQL API at https://api.fly.io/graphql. You can check your app's status:
curl -H "Authorization: Bearer $FLY_API_TOKEN" \
-H "Content-Type: application/json" \
https://api.fly.io/graphql \
-d '{"query":"{app(name:\"your-app-name\"){status}}"}
Add this as a monitor with your Fly API token. A healthy app returns {"data": {"app": {"status": "running"}}}.
Monitoring Fly.io Postgres
If you use Fly Postgres, monitor your app's database-dependent endpoint:
https://your-app.fly.dev/api/health?check=db
Implement this to do a quick SELECT 1 against your Fly Postgres cluster. A failed response means your app-to-DB connection is broken even if both are "running" individually.
Region-Specific Monitoring
Fly.io supports multi-region deployments. If you deploy to iad and fra, check that both regions respond:
https://your-app.fly.dev (with Vigilmon EU checker)
https://your-app.fly.dev (with Vigilmon US checker)
Vigilmon's multi-region checks handle this automatically — if EU check fails but US passes, you get an alert flagging the EU region specifically.
Scale-to-Zero Monitoring
If your app uses auto_stop_machines = true (scale to zero), cold starts can cause timeouts. Configure Vigilmon:
- Timeout: 30 seconds (instead of default 10) to accommodate cold starts
- Consecutive failures before alert: 2 (cold start might fail once before machine is warm)
-
Alert on:
408 Timeoutor503 Service Unavailable
Certificate Monitoring
Fly manages TLS for .fly.dev domains automatically, but for custom domains you're responsible. Vigilmon monitors SSL certificate expiry automatically when you add an HTTPS monitor — you'll get an alert 14 days before expiry.
Example Monitoring Stack for a Fly.io App
Monitor 1: https://your-app.fly.dev → 200, keyword "loaded"
Monitor 2: https://your-app.fly.dev/health → 200, keyword "ok"
Monitor 3: https://your-app.fly.dev/api/health?check=db → 200, keyword "db:ok"
Monitor 4: https://yourproduct.com → 200 (custom domain + SSL)
When Fly.io Incidents Happen
Fly.io publishes status at https://status.fly.io. You can monitor their status API:
https://status.fly.io/api/v2/status.json
Keyword check: "All Systems Operational". If an incident is open, this keyword disappears and you get an alert.
Summary
Fly.io's internal restart policies keep your machines running, but they don't catch networking issues, TLS problems, or dependency failures. External monitoring from Vigilmon closes that gap.
Add your Fly.io app to Vigilmon — free plan, 5-minute checks, multi-region.
Vigilmon — uptime monitoring for modern cloud applications.
Top comments (0)