VPS Monitoring: How to Set Up Uptime, CPU, and Alert Notifications
A VPS running without monitoring is infrastructure flying blind. You won’t know when CPU spikes at 3 AM, when your disk is 95% full, or when your website goes down — until a customer tells you. Setting up proper monitoring takes less than an hour and gives you visibility, alerts, and historical data to catch problems before they become outages.
This guide covers four complementary monitoring tools: UptimeRobot (external uptime checks), Netdata (real-time server metrics), GoAccess (log analysis), and custom shell scripts for disk and memory alerts.
The Monitoring Stack You Need
| Tool | What it monitors | Cost |
|---|---|---|
| UptimeRobot | External uptime, HTTP response | Free (50 monitors) |
| Netdata | CPU, RAM, disk, network — real time | Free (self-hosted) |
| GoAccess | Web traffic, top pages, errors | Free |
| Custom cron scripts | Disk space, memory threshold alerts | Free |
Part 1: UptimeRobot — External Uptime Monitoring
UptimeRobot pings your site every 5 minutes from external servers worldwide. If your site goes down, you get an immediate email or SMS alert — before any user notices.
- Sign up free at uptimerobot.com
- Click Add New Monitor
- Select HTTP(s) type
- Enter your domain and set check interval to 5 minutes
- Add your email for alert notifications
For additional coverage, add monitors for your SSH port (port monitor) and key API endpoints. ✅
Part 2: Netdata — Real-Time Server Metrics Dashboard
Netdata installs as a lightweight agent and provides a stunning real-time dashboard showing every metric on your server — CPU per core, RAM, disk I/O, network throughput, running processes, and more.
Install Netdata
bash <(curl -Ss https://my-netdata.io/kickstart.sh) --non-interactive
Installation takes 2–3 minutes. Netdata starts automatically and listens on port 19999.
Secure Access to Netdata
Never expose port 19999 publicly. Access it through an SSH tunnel instead:
# On your local machine — forward port 19999 over SSH
ssh -L 19999:localhost:19999 user@YOUR_VPS_IP
Then open http://localhost:19999 in your browser — you’ll see the live Netdata dashboard. ✅
Set Up Netdata Alerts via Email
sudo nano /etc/netdata/health_alarm_notify.conf
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="you@youremail.com"
sudo systemctl restart netdata
Netdata ships with 200+ pre-configured alert rules. It will email you when CPU exceeds 80%, RAM is critically low, disk is filling up, or any service stops responding.
Part 3: Custom Shell Alerts for Disk and Memory
For simple threshold-based alerts without a full monitoring stack, custom scripts + cron work perfectly:
Disk Space Alert Script
nano ~/check-disk.sh
#!/bin/bash
THRESHOLD=85
EMAIL="you@youremail.com"
HOSTNAME=$(hostname)
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do
USAGE=$(echo $output | awk '{ print $1}' | cut -d'%' -f1)
PARTITION=$(echo $output | awk '{ print $2 }')
if [ $USAGE -ge $THRESHOLD ]; then
echo "ALERT: $PARTITION on $HOSTNAME is ${USAGE}% full" | \
mail -s "⚠️ Disk Alert: $HOSTNAME" $EMAIL
fi
done
chmod +x ~/check-disk.sh
# Schedule every hour
crontab -e
# 0 * * * * /bin/bash /root/check-disk.sh
Memory Alert Script
nano ~/check-memory.sh
#!/bin/bash
THRESHOLD=90
EMAIL="you@youremail.com"
TOTAL=$(free | awk '/^Mem:/{print $2}')
USED=$(free | awk '/^Mem:/{print $3}')
USAGE=$((USED * 100 / TOTAL))
if [ $USAGE -ge $THRESHOLD ]; then
echo "ALERT: Memory usage is ${USAGE}% on $(hostname)" | \
mail -s "⚠️ Memory Alert: $(hostname)" $EMAIL
fi
Part 4: GoAccess — Web Traffic Log Analysis
GoAccess analyzes your Nginx access logs and generates beautiful HTML reports showing top pages, traffic sources, response codes, bandwidth usage, and bot traffic.
sudo apt install goaccess -y
# Generate a static HTML report
goaccess /var/log/nginx/access.log \
--log-format=COMBINED \
--output=/var/www/html/report.html
# Real-time terminal dashboard
goaccess /var/log/nginx/access.log --log-format=COMBINED
Schedule Weekly Reports
crontab -e
# Generate report every Monday at 6 AM
0 6 * * 1 goaccess /var/log/nginx/access.log --log-format=COMBINED \
--output=/var/seo/reports/traffic-$(date +\%Y-\%m-\%d).html
Part 5: Monitor with Prometheus + Grafana (Advanced)
For teams needing long-term metric retention, historical graphs, and multi-server dashboards, Prometheus + Grafana is the industry standard:
# Install Node Exporter (exposes server metrics to Prometheus)
wget https://github.com/prometheus/node_exporter/releases/latest/download/node_exporter-1.8.2.linux-amd64.tar.gz
tar xvfz node_exporter-*.tar.gz
sudo mv node_exporter-*/node_exporter /usr/local/bin/
# Create systemd service
sudo nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
ExecStart=/usr/local/bin/node_exporter
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
Then install Prometheus and Grafana on the same or a dedicated VPS to scrape and visualize the metrics. Grafana’s pre-built “Node Exporter Full” dashboard gives you a professional monitoring setup in minutes.
Final Thoughts
Monitoring isn’t optional for production infrastructure — it’s what separates proactive operations from reactive firefighting. Start with UptimeRobot (5 minutes to set up) and Netdata (5 minutes to install), and you’ll have meaningful visibility into your VPS health immediately. Add disk and memory alert scripts for comprehensive coverage, and you’ll be notified of any issue before it impacts users.
Related articles: