PythonintermediatedevopsAI generated

Server Health Monitoring Script with Alerts

Write a script that periodically checks CPU, memory, and disk usage on a machine, logs the results, and sends an email or Slack alert when thresholds are exceeded. Learners practice the psutil library, scheduling with a loop or cron, and integrating a notification API.

Estimate
~7.5h
Steps
5
Completed by
0
Proposed by
codeseed.app

psutil · smtplib · requests

Project roadmap

  1. 01

    Collect system metrics

    ~1.5h

    Use psutil to gather CPU, memory, and disk usage, writing results to a rotating log file.

  2. 02

    Define alert thresholds

    ~1.5h

    Add configurable thresholds and logic that flags when a metric is exceeded for a sustained period.

  3. 03

    Implement email or Slack notifications

    ~2h

    Send an alert via SMTP email or a Slack webhook when a threshold breach is detected.

  4. 04

    Add scheduling

    ~1h

    Run the check on a loop with sleep intervals or provide a cron-compatible entry point.

  5. 05

    Add a simple status report command

    ~1.5h

    Add a CLI flag that prints a current snapshot report of all monitored metrics on demand.

Ready to build this?

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

~7.5h · 5 steps

Tech stack

psutilsmtplibrequests