NewCode CLOUD — 20% off your first month on all cloud VPSClaim

Linux Server Monitoring: htop, iotop, vnStat, Netdata and More

When a website slows down or a server feels sluggish, you need answers quickly: is it CPU, memory, disk or network — and which process is responsible? Linux has excellent tools for each question. This guide covers the ones worth knowing, from built-in commands to dashboards that keep history, and explains how to read what they show.

Quick health check in 60 seconds

Run these when something feels wrong:

uptime                 # load averages
free -h                # memory and swap
df -h                  # disk space
top -bn1 | head -20    # top processes, one snapshot
dmesg -T | tail -20    # recent kernel messages (OOM kills, disk errors)
ss -s                  # connection summary

Together they answer the first question: which resource is under pressure.

CPU and processes: top and htop

top is installed everywhere. htop is friendlier — colour bars per core, mouse support, tree view, easy sorting and killing:

sudo apt install htop      # or: sudo dnf install htop
htop

Useful keys in htop: F6 sort (by CPU%, MEM%), F5 tree view, F4 filter by name, F9 send a signal, Shift+H hide threads.

Reading the CPU line in top:

%Cpu(s): 23.5 us, 4.1 sy, 0.0 ni, 70.2 id, 1.9 wa, 0.0 hi, 0.3 si, 0.0 st
Field Meaning Worry when
us User programs (PHP, Node, database) Constantly near 100%
sy Kernel High together with network or disk load
wa Waiting for disk I/O Above ~10–20% regularly → disk bottleneck
st “Steal” — CPU taken by the hypervisor (VPS) Consistently high on a VPS
id Idle

Load average (from uptime) is the average number of processes running or waiting. Compare with the number of cores (nproc). A load of 6 on a 4-core server means work is queuing. High load with low CPU usage usually means processes waiting on disk.

For a detailed walkthrough of CPU problems, see troubleshooting high CPU load.

Memory: free and vmstat

free -h
               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       3.1Gi       512Mi       120Mi       4.1Gi       4.2Gi
Swap:          2.0Gi       0.0Gi       2.0Gi

Look at available, not free. Linux uses spare RAM as disk cache (buff/cache) and releases it when programs need it — low “free” is normal and good.

vmstat 2 10

Watch si/so (swap in/out). Sustained non-zero values mean the server is short of memory — see swap and memory.

Find out-of-memory kills:

sudo journalctl -k | grep -iE "out of memory|oom-kill"

Disk I/O: iostat and iotop

sudo apt install sysstat iotop    # or dnf
iostat -xz 2
sudo iotop -oPa

In iostat -x, the key columns are:

Column Meaning
r/s, w/s Reads/writes per second
r_await, w_await Average milliseconds per request — high values mean slow responses
%util How busy the device is (near 100% = saturated, on single-queue devices)

iotop -oPa shows which processes are reading and writing, accumulated since start. Typical culprits: database queries without indexes, backups, log-heavy applications, swap.

Disk space

df -h
df -i                                   # inodes
sudo du -xh --max-depth=1 / | sort -h
sudo ncdu -x /                          # interactive

Full disks break databases and websites in confusing ways — see fixing a full disk.

Network: vnStat, iftop, nload, ss

vnStat records traffic per interface over days and months — useful to see how much bandwidth you really use:

sudo apt install vnstat
sudo systemctl enable --now vnstat
vnstat            # summary (data starts collecting after install)
vnstat -d         # daily
vnstat -m         # monthly
vnstat -l         # live

iftop shows live bandwidth per connection; nload shows totals in and out as graphs:

sudo iftop -i eth0 -P
nload eth0

ss shows connections:

ss -tan state established | wc -l                   # number of established TCP connections
ss -tan | awk '{print $1}' | sort | uniq -c         # by state
ss -tnp | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | head   # top remote IPs

Many connections from one IP may be a scraper or an attack — see Nginx rate limiting.

Everything at once: glances and btop

sudo apt install glances btop
glances
btop

glances shows CPU, memory, disk, network, processes and sensors on one screen and can run in web mode (glances -w). btop is a visually rich alternative to htop. Do not expose glances’ web mode to the internet without authentication.

Real-time dashboards: Netdata

Netdata collects thousands of metrics per second with almost no configuration and shows them in a web dashboard, including per-application charts for Nginx, MySQL, PHP-FPM, Redis and Docker.

curl https://get.netdata.cloud/kickstart.sh -o /tmp/netdata-kickstart.sh
sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry

The dashboard listens on port 19999. Do not open that port to the internet. Access it through an SSH tunnel:

ssh -L 19999:127.0.0.1:19999 deploy@your-server
# then open http://localhost:19999

or put it behind Nginx with authentication. Netdata also ships with sensible alert rules (disk almost full, high load, OOM) that can notify you by email or chat.

Long-term history: Prometheus and Grafana

For several servers and months of history, the standard open-source stack is node_exporter on each server, Prometheus to collect and store metrics, and Grafana for dashboards and alerts. It takes more setup than Netdata but scales to many machines. Run it on a separate small server so monitoring still works when a production server is struggling.

External monitoring

Tools on the server cannot tell you the server is down. Add an external check that tests your website and ports from outside and alerts you — see Uptime Kuma.

What “normal” looks like

Record a baseline when everything is fine: typical load, memory available, disk usage growth per week, daily traffic in vnStat. When something goes wrong, comparing with the baseline is far faster than guessing.