Server monitoring helps you detect problems before they become critical. This guide shows you various methods – from simple console commands to professional monitoring tools. This way you always keep an eye on CPU, RAM, disk space and network.
Note: Detailed subpages on individual tools can be found in the left navigation.
Why monitoring is important
- Detect problems early before users complain
- Identify bottlenecks and upgrade selectively
- Track down crashes and their causes
- Recognize long-term trends (e.g. increasing load due to more visitors)
1. Real-time monitoring via console
htop – Interactive process monitor
htop
htop displays CPU, RAM and swap in colored bars. You can sort, filter and kill processes at the press of a key. The most important indicators:
- CPU bars at the top: One bar per core. Full load on one core = single-thread problem
- RAM bar: Green = used, Blue = buffers, Yellow = cache. Only when green is full does it become tight
- Load Average: Three numbers (1, 5, 15 minutes). Higher than core count = overload
- Swap: Visible in the upper area. Constant swap usage = RAM problem
Glances – Everything at a glance
# Installation
apt install glances # Debian/Ubuntu
pip install glances # Alternatively via pip
# Start
glances
Glances combines CPU, RAM, I/O, network and disks in a single view. Less interactive than htop, but clearer for a quick overview. With glances -w you start a web server on port 61208 for browser access.
2. Monitoring disk space
df – Check partitions
df -h
Shows all partitions with size, used and available space. Watch for values above 90% – then it becomes critical.
ncdu – Interactive disk space analyzer
apt install ncdu
ncdu /
ncdu shows folder sizes in a navigable tree view. Perfect for finding space hogs. Navigate with arrow keys, delete with d.
Automatic alert via script
#!/bin/bash
# Disk space alert via email
THRESHOLD=90
df -h | awk '{if (NR!=1) {print $5 " " $6}}' | while read output; do
usep=$(echo $output | awk '{print $1}' | cut -d'%' -f1)
partition=$(echo $output | awk '{print $2}')
if [ $usep -ge $THRESHOLD ]; then
echo "Warning: Partition $partition is $usep% full" | mail -s "Disk Space Warning" [email protected]
fi
done
Set up as a daily cronjob:
0 8 * * * /path/to/script.sh
3. Network monitoring
iftop – Real-time bandwidth usage
apt install iftop
iftop -i eth0
Shows which connections are using how much bandwidth. Sender on the left, receiver on the right. Useful to see if a single client is flooding the server or a backup is blocking the line.
nload – Simple bandwidth monitor
apt install nload
nload eth0
Shows incoming and outgoing traffic as graphs with average and peak values. Fewer details than iftop, but easier to interpret.
vnstat – Traffic statistics over time
apt install vnstat
vnstat -d # Daily statistics
vnstat -m # Monthly statistics
vnstat -h # Hourly statistics
vnstat runs as a daemon and records traffic data continuously. Ideal for long-term analysis – unlike iftop, which only shows the current moment.
4. Long-term monitoring and notifications
Netdata – Professional monitoring with web interface
# Installation (one command)
bash