BashintermediatedevopsAI generated

Website Uptime Monitor with Email Alerts

A monitoring script that periodically checks a list of URLs with curl, records response times and status codes to a history file, and sends an email alert via mailx when a site goes down or exceeds a latency threshold. Learners practice curl scripting, cron scheduling, and state tracking to avoid alert spam.

Estimate
~9.5h
Steps
6
Completed by
0
Proposed by
codeseed.app

curl · cron · mailx

Project roadmap

  1. 01

    Define the URL watchlist and config file

    ~1h

    Create a config file listing URLs, expected status codes, and latency thresholds to monitor.

  2. 02

    Write the check function using curl

    ~2h

    Use curl -w to capture HTTP status and response time for each URL without downloading the full body.

  3. 03

    Persist results to a history log

    ~1.5h

    Append each check's timestamp, status, and latency to a CSV log file for later analysis.

  4. 04

    Implement stateful alerting

    ~2.5h

    Track last-known state per URL so alerts only fire on state transitions (up to down), preventing repeated emails.

  5. 05

    Wire up email notifications

    ~1.5h

    Send a formatted alert email via mailx when a down or slow state is detected, including recent history.

  6. 06

    Schedule via cron and add log rotation

    ~1h

    Add a crontab entry to run checks every 5 minutes and rotate the history log weekly.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~9.5h · 6 steps

Tech stack

curlcronmailx