Lesson 7 of 9 · 21m
Linux Observability: The First Ten Minutes of an Incident
A practical evidence-gathering order using uptime, ps, vmstat, iostat, ss, dmesg, and pressure metrics before changing anything.
During an incident, the worst move is changing the system before capturing evidence. Linux already records most of what you need; the trick is knowing which question each tool answers. In the first ten minutes, you are not trying to solve the whole problem. You are trying to classify the bottleneck and preserve enough evidence to avoid guessing later.
Start with load, but do not stop there
uptime
# 22:31:18 up 44 days, load average: 18.42, 11.03, 5.91Load average includes runnable tasks plus uninterruptible sleepers, not just CPU. On a 16-core host, 18 means slight queueing; on a 2-core host it is severe. The trend matters: rising load with rising CPU suggests compute saturation, while rising load with low CPU suggests I/O or lock waits.
Build the quick matrix
Use vmstat 1 5 for runqueue and blocked tasks, sar -u 1 5 for CPU breakdown, iostat -x 1 5 for storage, ss -s for sockets, and ps aux --sort=-%cpu or --sort=-rss for process outliers. You are filling four boxes: CPU, memory, disk, network. One usually jumps out; if none does, the bottleneck may be external and the host is waiting rather than overloaded.
Pressure Stall Information is the shortcut
cat /proc/pressure/cpu
cat /proc/pressure/memory
cat /proc/pressure/ioPSI answers 'how much time did tasks lose because this resource was unavailable?' That is closer to user pain than utilization. High IO pressure with normal utilization means threads waited on storage. High memory pressure means reclaim is interfering with execution. CPU pressure means runnable threads could not be scheduled promptly.
Kernel logs explain hardware and subsystem events
dmesg -T | tail -80
journalctl -k --since '15 minutes ago'Look for I/O errors, filesystem warnings, OOM kills, network driver resets, and cgroup events. Application logs often start seconds or minutes after the kernel noticed trouble. Timestamps let you line up cause and symptom.
Sockets tell a different story than packets
ss -tan state time-wait | wc -l
ss -i dst 10.0.4.18A flood of TIME_WAIT can be normal for short-lived outbound connections. SYN-SENT means connect attempts are not completing. ESTAB with large retransmission counters points at network quality. Socket state is often more useful than bandwidth graphs because it shows connection lifecycle failure directly.
Capture before remediation
If you can afford thirty seconds, capture a bundle:
mkdir /tmp/incident-$(date +%s) && cd /tmp/incident-*
vmstat 1 10 > vmstat.txt & iostat -x 1 10 > iostat.txt &
ps auxf > ps.txt; ss -tanp > sockets.txt; dmesg -T | tail -200 > dmesg.txtThen remediate. Rebooting first erases the state you needed. Even when the fix is obvious, evidence turns the postmortem into engineering rather than folklore.
Field notes
- 'Top CPU process' may be the victim retrying failed downstream calls; check timestamps and time zones before correlating host and application logs.
- In containers, host-wide tools can mislead if you look only inside the namespace. Compare cgroup and host views.
- Save command output, not screenshots of terminals. Text can be grepped, diffed, and attached to the incident record.
Was this lesson helpful?