Pcornel
Linux

Resource Monitoring

Cheat sheet · https://pcornel.dk/topic.php?topic=361

Back to the Topic

Answer

Resource monitoring measures CPU, memory, disk I/O and load to tell whether a resource is busy, saturated or failing, using tools such as top, vmstat, free, iostat, sar and pidstat.

Remember

Utilisation alone does not prove a bottleneck — look for saturation (run queue, swap activity, I/O wait and latency). Keep history (sysstat's sar or a monitoring system) to compare with normal.

First checks

  • uptime — load averages
  • vmstat 1 5 — run queue, swap, I/O wait
  • free -h — available memory
  • iostat -xz 1 3 — disk latency and utilisation
  • sar -u -r -d — history (sysstat)

Commands

free
Report physical memory and swap totals, use, availability and cache accounting.
uptime
Show system uptime, logged-in user count and recent load averages.
vmstat
Sample process, memory, paging, block I/O, interrupt and CPU scheduler counters.
iostat
Report CPU utilization and per-device I/O throughput, queueing and latency counters.
sar
Read or collect historical system activity counters across CPU, memory, I/O and networking.
lsof
List open file descriptors and the processes, files, sockets or devices associated with them.
dmesg
Read or control the kernel ring buffer used for boot, driver and runtime kernel messages.
iostat -xz 1 3
Read current Performance & Health state for a bounded verification step.

Verify in this order

workload → CPU, memory, disk and network use → saturation found → process identified

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=361

Confirmation

Confirm action

Continue?