Skip to content

Set up uptime monitoring and alerting #39

@michaeldistel

Description

@michaeldistel

Problem

No monitoring means:

  • Downtime invisible until users report
  • No SLA tracking
  • Can't measure availability
  • Slow incident response

Solution

Use UptimeRobot (free tier) for basic monitoring:

UptimeRobot Setup

  1. Create account: https://uptimerobot.com

  2. Add HTTP(s) monitor:

  3. Add ping endpoints:

Alert Channels

  • Email
  • Slack webhook
  • Discord webhook
  • SMS (paid tier)

Health Check Endpoint

// src/routes/api/health/+server.ts
export async function GET() {
  const health = {
    status: 'healthy',
    timestamp: new Date().toISOString(),
    uptime: process.uptime(),
    version: import.meta.env.VITE_BUILD_COMMIT
  };
  
  return new Response(JSON.stringify(health), {
    headers: { 'Content-Type': 'application/json' }
  });
}

Alternative: BetterUptime

More features, better UX:

  • Status page (public)
  • Incident management
  • On-call scheduling
  • Free tier: 10 monitors

Monitoring Checklist

Status Page

Create public status page showing:

  • Uptime % (30/60/90 day)
  • Current status
  • Incident history
  • Scheduled maintenance
<!-- src/routes/status/+page.svelte -->
<script>
  let status = { operational: true, uptime: 99.9 };
</script>

<h1>System Status</h1>

<div class="status {status.operational ? 'operational' : 'outage'}">
  {status.operational ? '✓ All Systems Operational' : '⚠️ Experiencing Issues'}
</div>

<div class="uptime">
  <h2>Uptime</h2>
  <p>30 days: {status.uptime}%</p>
</div>

Alert Configuration

Send alerts when:

  • Site down for >2 minutes
  • Response time >3 seconds
  • SSL certificate expires <30 days
  • 4xx/5xx error rate >5%

Success Criteria

  • Monitoring configured for all endpoints
  • Alerts sent to email/Slack
  • Public status page available
  • Historical uptime data tracked
  • Response time monitored

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions