Monitor Linux CPU, Memory, Disk, and Process Activity
Before you begin
- Applies to:Linux hosts where you can sample CPU, memory, devices, and processes with sysstat tools.
- Where to start:Open a terminal on the affected host while the slowdown is happening.
- What you need:Have an approved way to install sysstat if it is missing. Record the affected workload and when you start sampling.
Guide tools
When a Linux host feels slow, a single snapshot rarely explains why. A short, repeatable sample of CPU, memory, storage, and process activity can show whether a workload is CPU-bound, waiting on disk, or under memory pressure.
This tutorial uses the sysstat tools: iostat for device activity and pidstat for per-process resource use. The examples collect observations only. Package names and availability vary by distribution.
Install sysstat and Confirm the Commands
SetupInstall the distribution’s sysstat package if iostat or pidstat is missing. These examples cover Debian/Ubuntu and Fedora/RHEL family package managers; use your distribution’s approved repository and change process.
# Debian or Ubuntusudo apt updatesudo apt install sysstat
# Fedora, RHEL, or compatible distributionssudo dnf install sysstat
command -v iostat pidstat❯ Illustrative Output (Results Vary)
/usr/bin/iostat/usr/bin/pidstatSample Run Queue, CPU, and Memory
System SnapshotRecord host uptime and memory first, then take five one-second samples with vmstat. In its CPU columns, high id means idle time; consistently low idle time can point to CPU pressure. Nonzero wa can indicate time waiting on I/O, while sustained swap activity deserves closer investigation. Interpret the whole sample rather than one interval.
What you should see · The interval reports show what CPU, memory, and queue activity looked like while the slowdown was happening.
If you see something else · If the sample missed the slowdown, repeat it during the symptom. If storage activity is suspected, continue to Step 3. If a particular process stands out, use Step 4 to inspect it.
uptimefree -hvmstat 1 5❯ Illustrative Output (Results Vary)
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 ... ... ... 0 0 2 8 ... ... 12 3 84 1 0Review Per-Device I/O Statistics
Storage ActivityRun extended device statistics for five intervals. Compare devices over the same workload window. Queue depth, throughput, and await can help identify I/O pressure, but their meaning depends on device type and workload; high utilization alone does not prove a disk is the bottleneck.
iostat -xz 1 5❯ Illustrative Output (Results Vary)
Device r/s w/s rkB/s wkB/s await aqu-sz %utilnvme0n1 ... ... ... ... ... ... ...Attribute Resource Use to Processes
Process DetailSample per-process CPU, memory, and I/O counters during the same period as the system-wide checks. The -d option adds I/O statistics and -r adds memory statistics. Use sudo when you need visibility into processes owned by other users.
sudo pidstat -dur 1 5❯ Illustrative Output (Results Vary)
Linux ...# Time UID PID %usr %system %CPU Command... ... ... ... ... ... service-name
Figure 1: Live CPU, memory, disk, and per-process samples collected with vmstat, iostat, and pidstat.
Relate the Metrics to the Symptom
AnalysisRepeat the same commands while the issue is happening and during a healthy period. Note the time, workload, host name, and unusual values. Compare the pattern: busy CPU with a long run queue suggests compute contention; growing swap use can point to memory pressure; elevated I/O wait together with device latency suggests storage needs attention. Confirm findings against application metrics and logs before changing configuration.
hostnameuptimefree -hvmstat 1 5iostat -xz 1 5sudo pidstat -dur 1 5❯ Illustrative Output (Results Vary)
Keep timestamped samples from comparable workload windows so trends can be compared.Your feedback keeps these production procedures accurate and battle-tested.