Exclusive Metin2 game shield on FreeBSD: Automatic siege mode, VIP list, and whitelist from your dashboard. See how it works
Create a server

Guide

How to Set Up a Monitoring Alert with Email

Email alerts catch problems before users do. A small script plus cron covers basic thresholds without a full monitoring stack.

Steps

  1. Install a local mail client (configure SMTP/relay for your provider):

    sudo apt update
    sudo apt install -y mailutils
  2. Create a script that emails when root disk exceeds 85%:

    sudo tee /usr/local/bin/disk-alert.sh >/dev/null <<'EOF'#!/bin/bashTHRESHOLD=85USAGE=$(df -P / | awk 'NR==2 {gsub(/%/,"",$5); print $5}')HOST=$(hostname -f)if [ "$USAGE" -ge "$THRESHOLD" ]; then  echo "Disk ${USAGE}% on ${HOST}" | mail -s "[ALERT] disk ${HOST}" [email protected]
    sudo chmod +x /usr/local/bin/disk-alert.sh
  3. Run it once and schedule every 5 minutes:

    sudo /usr/local/bin/disk-alert.sh
    (sudo crontab -l 2>/dev/null; echo "*/5 * * * * /usr/local/bin/disk-alert.sh") | sudo crontab -
  4. Confirm the cron line:

    sudo crontab -l

Tips

  • Replace [email protected] and configure a real SMTP/relay or mail will not leave the host.
  • Reuse the same pattern for CPU/RAM with loadavg or free.

ext step

Monitor a production VPS from day one: Deploy your Cloud VPS.

Related guides