Find us on social media
MonitoringCPURAM5 min read
Monitor CPU, RAM and disk
Monitor CPU, RAM, disk, and network usage on your VPS to detect performance issues early.
Monitoring your VPS resources helps you identify bottlenecks, plan upgrades and detect anomalies before they cause downtime.
Quick overview with htop
Install and run htop for an interactive process viewer:
bash
sudo apt install htop -y
htophtop shows CPU usage per core, memory usage, swap, load average and running processes. Press q to exit.
Memory usage
bash
free -hShows total, used, free, shared, buffer/cache and available memory.
Disk usage
bash
# Overall disk usage
df -h
# Directory sizes
du -sh /var/log
du -sh /home/*
# Find largest files
sudo find / -type f -size +100M -exec ls -lh {} \;CPU information
bash
# Number of cores
nproc
# Detailed CPU info
lscpu
# Current load average
uptimeI/O monitoring with iotop
bash
sudo apt install iotop -y
sudo iotopShows which processes are reading/writing to disk.
Network monitoring
bash
# Bandwidth per interface
sudo apt install iftop -y
sudo iftop
# Connection statistics
ss -tulnContinuous monitoring with vmstat
bash
vmstat 5 # Update every 5 secondsSet up alerts (optional)
Create a simple script to alert on high usage:
bash
#!/bin/bash
CPU=$(top -bn1 | grep 'Cpu(s)' | awk '{print $2}')
MEM=$(free | grep Mem | awk '{printf "%.0f", $3/$2 * 100}')
DISK=$(df / | tail -1 | awk '{print $5}' | tr -d '%')
echo "CPU: ${CPU}% | RAM: ${MEM}% | Disk: ${DISK}%"Tip
For production VPS on Baires Host, consider setting up Prometheus + Grafana or Netdata for continuous monitoring with dashboards and alerting.
Was this guide helpful?