Resource Monitoring

Monitoring your server's resources is essential to understand if the system is running correctly or approaching its limits.

02

CPU and RAM in real time

top: basic monitor (already installed)

bash
top

Useful keys inside top:

htop: advanced monitor (recommended)

bash
# Installation
apt install htop   # Debian/Ubuntu
dnf install htop   # CentOS/AlmaLinux

# Launch
htop

htop shows graphical bars for each CPU core and RAM, and is much more readable than top.

  • P: sort by CPU
  • M: sort by RAM
  • k: kill a process (enter the PID)
  • q: exit
03

Current RAM usage

bash
free -h

Example output:

total used free shared buff/cache available Mem: 3.8G 1.2G 800M 45M 1.8G 2.4G RAM: 4.0G 0B 4.0G

The available column is the one that matters: it's the RAM actually available for new processes.

04

Current disk usage

bash
df -h

To see only the main partition:

bash
df -h /
05

Processes consuming the most resources

Top 10 processes using the most CPU:

bash
ps aux --sort=-%cpu | head -11

Top 10 processes using the most RAM:

bash
ps aux --sort=-%mem | head -11
06

Real-time network traffic

bash
# Install nethogs to see traffic by process
apt install nethogs
nethogs

# Or iftop to see traffic by connection
apt install iftop
iftop
07

Disk I/O statistics

bash
# Show disk I/O in real time
iostat -x 1

# To install (if not present)
apt install sysstat
08

System load (load average)

bash
uptime

Example output:

14:32:01 up 5 days, 3:21, 1 user, load average: 0.12, 0.08, 0.05

The three values are the load average for the last 1, 5 and 15 minutes. A value equal to the number of CPU cores indicates 100% utilization. Higher values indicate that there are processes waiting.

To find out how many cores you have:

bash
nproc

DeluxHost, founded in 2023, offers high-quality hosting solutions for various digital needs. We provide shared hosting, VPS, and dedicated servers with advanced security and global data centers.

© DeluxHost, All rights reserved. | VAT Number : IT17734661006
All Systems Operational