Linux VDS Server Monitoring: CPU, RAM, Disk and Network
Complete guide to monitoring Linux VDS server resources: htop, free, df, iostat commands, network monitoring tools, and automated alert scripts.
Table of Contents
Introduction
Monitoring your server's resource usage is essential for maintaining optimal performance and identifying potential issues before they become critical. This guide covers the most important commands and tools for monitoring CPU, RAM, disk, and network usage on Linux servers.
CPU Monitoring
top Command
The top command provides a real-time view of system processes:
top
Key metrics to watch:
- %us: User space CPU usage
- %sy: System (kernel) CPU usage
- %id: Idle CPU percentage
- load average: System load (1, 5, 15 minute averages)
Load average should ideally be below the number of CPU cores. For a 4-core server, a load average above 4.0 indicates the system is overloaded.
htop Command
htop is an enhanced version of top with a more user-friendly interface:
# Install htop
sudo apt install htop -y # Debian/Ubuntu
sudo yum install htop -y # CentOS/RHEL
# Run htop
htop
htop features:
- Color-coded CPU and memory bars
- Process tree view (F5)
- Easy process killing (F9)
- Search processes (F3)
- Sort by any column (F6)
CPU Information
# Number of CPU cores
nproc
# Detailed CPU info
lscpu
# Per-core usage
mpstat -P ALL 1 5
RAM Monitoring
free Command
free -h
Example output:
total used free shared buff/cache available
Mem: 7.8Gi 3.2Gi 1.1Gi 0.2Gi 3.5Gi 4.1Gi
Swap: 2.0Gi 0B 2.0Gi
| Column | Description |
|---|---|
| total | Total physical RAM |
| used | RAM in use |
| free | Completely unused RAM |
| buff/cache | RAM used for buffers and cache (reclaimable) |
| available | RAM available for new applications |
The "available" column is more important than "free". Linux uses free RAM for disk caching, which is automatically released when applications need it.
Swap Usage
# Check swap usage
swapon --show
free -h | grep Swap
# Find processes using swap
for file in /proc/*/status; do
awk '/VmSwap|Name/{printf $2 " " $3}END{print ""}' $file 2>/dev/null
done | sort -k2 -rn | head -10
High swap usage indicates insufficient RAM. Swap is much slower than RAM since it uses disk storage.
Disk Monitoring
Disk Space
# Disk usage summary
df -h
# Find largest directories
du -sh /* 2>/dev/null | sort -rh | head -10
# Find large files
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -k5 -rh | head -10
Disk I/O
# Install iostat
sudo apt install sysstat -y
# Monitor disk I/O
iostat -x 1 5
# Process-level I/O
sudo iotop -o
If disk usage exceeds 90%, performance issues may occur. Above 95% is critical — free up space immediately.
Network Monitoring
# Network interface statistics
ifconfig eth0
# Connection summary
ss -s
# Active connections by IP
ss -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | head -10
# Bandwidth monitoring (requires nload)
sudo apt install nload -y
nload eth0
Quick Health Check Script
#!/bin/bash
echo "=== CPU ==="
top -bn1 | head -5
echo ""
echo "=== RAM ==="
free -h
echo ""
echo "=== DISK ==="
df -h /
echo ""
echo "=== LOAD ==="
uptime
echo ""
echo "=== TOP PROCESSES ==="
ps aux --sort=-%cpu | head -5
When to Contact Support
- Hardware-level issues suspected
- Network performance degradation
- OOM killer repeatedly triggered
- Unexplained resource consumption
Related Articles
How to Connect to Your VDS Server via SSH (Complete Guide)
Step-by-step SSH connection guide for Linux VDS: PuTTY, Terminal, key-based authentication, Path Panel firewall rules, and security best practices.
How to Connect to Windows VDS via RDP: Complete Guide
Complete guide to connecting to Windows Server VDS via Remote Desktop (RDP): setup steps, NLA security, Path Panel firewall rule, and troubleshooting tips.
How to Change VDS Server OS: Step-by-Step Reinstall Guide
Step-by-step guide to changing your VDS server OS via REXE panel: backup tips, supported Linux distributions and Windows Server versions explained.