Commands like top show the load right now. When the question is "why was everything slow at 3 in the morning?", you need a history. Ubuntu records it with sysstat: every 10 minutes it saves the use of processor, memory, disks and network, and sar shows it. The commands were tested on Ubuntu 26.04 LTS, where sysstat was already installed and recording.


1. Is It Recording?

ls /var/log/sysstat/

Files like sa27 and sa28 hold the data of the 27th and 28th day of the month. If the folder is missing or empty, switch it on:

apt install sysstat
sed -i 's/^ENABLED=.*/ENABLED="true"/' /etc/default/sysstat
systemctl enable --now sysstat

The first values appear after 10 minutes. The history is kept for 7 days (HISTORY=7 in /etc/sysstat/sysstat).

2. Processor

sar -u

One line per 10 minutes of today, in the time zone of the server:

12:00:01 AM  CPU  %user  %nice  %system  %iowait  %steal  %idle
03:10:00 AM  all   1.70   0.00     0.28     1.27    0.00  96.75
03:20:15 AM  all   0.53   0.07     0.25     0.56    0.00  98.60
  • %idle: unused. Values near 0 for a long time mean the processor is the limit.
  • %iowait: the processor waits for the disks. High values point to slow or busy disks, not to the processor.
  • %nice: programs running with low priority. A video conversion started with nice, for example, shows up here.

3. Load, Memory, Disks, Network

  • sar -q: the load average (ldavg-1, -5, -15). Compare it with the number of processor threads (nproc).
  • sar -r: memory. %memused is what programs use; kbcached is the disk cache, which Linux gives back when programs need it; kbavail is what is still available. For example, programs use 4 % while the cache holds about 7 GB.
  • sar -S: swap. Growing %swpused means the memory is too small.
  • sar -d -p: each disk with await (milliseconds per request) and %util (how busy it was).
  • sar -n DEV --iface=eno0: the network card, here eno0; rxkB/s is received, txkB/s sent. ip -br link shows the name of yours.

4. Another Day or a Time Range

Add the file of the day and, if you like, a start and end time:

sar -u -f /var/log/sysstat/sa27 -s 23:00:00 -e 23:59:00

This shows the processor between 11 and 12 PM on the 27th, for example almost idle at 99.98 %idle. The same works with -q, -r, -d -p and -n DEV.

Next Steps

Found the busy time? Check what ran then: the logs of that hour (Find Errors in the Logs of Your Linux Server: journalctl) and your timed tasks (Run Tasks on a Schedule on Linux: cron and systemd Timers). For the load right now: What Fills the Disk and What Loads the Server.


Related Guides

View all Linux guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)