DEV Community

Cover image for How to Set Up Website Monitoring That Actually Works: A Developer's Guide
shreef entsar
shreef entsar

Posted on

How to Set Up Website Monitoring That Actually Works: A Developer's Guide

Your website is down.
You don't know it yet, but your users do.
They're leaving.
Some are tweeting about it.
Your SSL certificate expired three days ago, and Chrome is showing that scary "Not Secure" warning to everyone.
Your domain expired and you forgot to renew it?

These scenarios play out thousands of times daily.
The frustrating part? It's entirely preventable.

Why Most Monitoring Setups Fail

Problem 1: Single-Location Monitoring

Your server is in Virginia. Your monitoring pings from Virginia. Everything looks fine.

Meanwhile, users in Europe are experiencing 5-second load times due to a CDN issue, and your MENA region users can't connect at all because of a routing problem.

Solution: Monitor from multiple geographic locations.

Problem 2: Only Checking HTTP 200

# This is what most basic monitoring does
curl -s -o /dev/null -w "%{http_code}" https://yoursite.com
# Returns: 200
# You think: "Great, site is up!"
Enter fullscreen mode Exit fullscreen mode

But a 200 status doesn't mean your site works. Your API could be returning errors. Your database connection could be failing.

Problem 3: Forgetting SSL Certificates

SSL certificates expire. When they do, browsers block access to your site entirely.

Problem 4: Domain Expiration

This one is embarrassing, but it happens more often than you'd think. Your domain expires because:

  • The credit card on file expired
  • Renewal emails went to spam
  • The person who registered it left the company

When your domain expires, your entire online presence vanishes. Worse, domain snippers can grab it within hours.


Building a Proper Monitoring Strategy

Layer 1: Endpoint Health Checks

Create a dedicated health endpoint:

// Express.js health endpoint example
app.get('/api/health', async (req, res) => {
  const health = {
    status: 'healthy',
    timestamp: new Date().toISOString(),
    checks: {}
  };

  // Check database
  try {
    await db.query('SELECT 1');
    health.checks.database = 'ok';
  } catch (e) {
    health.checks.database = 'failing';
    health.status = 'unhealthy';
  }

  // Check Redis
  try {
    await redis.ping();
    health.checks.cache = 'ok';
  } catch (e) {
    health.checks.cache = 'failing';
    health.status = 'unhealthy';
  }

  const statusCode = health.status === 'healthy' ? 200 : 503;
  res.status(statusCode).json(health);
});
Enter fullscreen mode Exit fullscreen mode

Layer 2: SSL Certificate Monitoring

Set up alerts at multiple thresholds:

Days Before Expiry Alert Level
30 days Reminder
14 days Warning
7 days Critical
1 day Emergency

Layer 3: Domain Expiry Monitoring

Your domain is the foundation of everything. Monitor it separately from SSL:

  • Track expiry dates for all your domains
  • Set up alerts 60/30/14/7 days before expiration
  • Include secondary domains you own
  • Don't rely on registrar emails—they often get filtered as spam

Layer 4: Multi-Region Checks

Monitor from at least three geographic regions:

  • Americas (US East/West)
  • Europe (Frankfurt/London)
  • Asia-Pacific/MENA (Singapore, Dubai, Riyadh)

Setting This Up with Uptime Chef

I've been using Uptime Chef because it monitors from worldwide locations including MENA region (Riyadh, Cairo, Dubai)—which most services don't offer.

Step 1: Add Your Monitors

After signing up:

  1. Homepage monitor - Basic availability
  2. Health endpoint monitor - Your /api/health
  3. SSL monitor - Certificate expiration
  4. Domain monitor - Domain expiry tracking

Step 2: Configure Webhook Alerts

Slack Integration

{
  "webhook_url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
  "payload_template": {
    "text": "🚨 Alert: {{monitor_name}} is {{status}}",
    "blocks": [
      {
        "type": "section",
        "text": {
          "type": "mrkdwn",
          "text": "*{{monitor_name}}*\nStatus: {{status}}\nResponse Time: {{response_time}}ms"
        }
      }
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

Discord Integration

{
  "webhook_url": "https://discord.com/api/webhooks/YOUR/WEBHOOK",
  "payload_template": {
    "embeds": [{
      "title": "{{monitor_name}} is {{status}}",
      "color": 15158332,
      "fields": [
        {"name": "Response Time", "value": "{{response_time}}ms"}
      ]
    }]
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Create a Status Page

For SaaS products, a public status page (like status.yourcompany.com) builds trust and reduces support tickets.

Step 4: API Integration

// Fetch monitor status via API
const response = await fetch('https://dashboard.uptimechef.com/v1/monitors', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const monitors = await response.json();
monitors.forEach(monitor => {
  console.log(`${monitor.name}: ${monitor.status}`);
});
Enter fullscreen mode Exit fullscreen mode

Monitoring Checklist

  • [ ] Homepage and critical pages monitored
  • [ ] API health endpoints monitored
  • [ ] SSL certificates monitored (30/14/7 day alerts)
  • [ ] Domain expiry monitored (60/30/14/7 day alerts)
  • [ ] Monitoring from 2-3 geographic regions
  • [ ] Alerts configured (email + Slack/Discord)
  • [ ] Status page set up

The Cost of Not Monitoring

Let's do quick math:

Scenario Cost
Average e-commerce revenue $10,000/day
1 hour undetected downtime ~$417 lost
6 hours overnight downtime ~$2,500 lost

Compare that to Uptime Chef's free tier or paid plans starting at $0.99/month.


Conclusion

Good monitoring isn't about more alerts—it's about the right alerts, from multiple locations, for the right endpoints.

Start with the basics:

  1. Monitor your health endpoint, not just your homepage
  2. Track SSL certificate expiration
  3. Track domain expiry dates
  4. Monitor from multiple regions if you have international users
  5. Set up webhooks to integrate with your existing tools

Try it out: Uptime Chef has a free tier for side projects.


What's your monitoring setup? Share your war stories in the comments!

Top comments (0)