Ubuntu 26.04

SysStat : How to use2026/06/09

 

How to use SysStat.
To input [sar] command with specifying options like follows, it's possible to display logs.
(refer to [man sar] for more details)

Option Description
-u CPU utilization statistics
-r Memory utilization statistics
-b I/O and transfer rate statistics
-B Paging statistics
-d Activity for each block device
-n [keyword] Network statistics
-q Queue length and load averages
-A Display All

[1] Display today's statistics reports.
# CPU

root@dlp:~#
sar -u

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

00:28:29     LINUX RESTART      (2 CPU)

00:30:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
00:40:08        all      0.88      0.05      0.36      0.50      0.00     98.21
00:50:09        all      0.35      0.04      0.10      0.10      0.00     99.40
01:00:09        all      0.21      0.00      0.05      0.06      0.00     99.68
01:10:09        all      0.25      0.00      0.05      0.06      0.00     99.65
.....
.....

# memory

root@dlp:~#
sar -r

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

00:28:29     LINUX RESTART      (2 CPU)

00:30:01    kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
00:40:08      2282260   2982608    202300      5.81     40772    850580    638908      8.54    292696    701988       120
00:50:09      2259192   2965152    219548      6.31     42524    854288    685516      9.16    304920    706356       212
01:00:09      2284308   2992216    192424      5.53     43228    855520    642764      8.59    297560    708288       144
01:10:09      2254192   2963988    220600      6.34     43940    856704    651660      8.71    307804    710176       104
.....
.....

# I/O

root@dlp:~#
sar -b

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

00:28:29     LINUX RESTART      (2 CPU)

00:30:01          tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
00:40:08        23.33      9.47     10.57      3.29    205.62   1519.81  76720.81
00:50:09         1.54      0.05      1.49      0.00      5.43    220.40      0.00
01:00:09         0.98      0.00      0.98      0.00      0.00     16.77      0.00
01:10:09         0.67      0.00      0.67      0.00      0.00     12.45      0.00
.....
.....

# network

root@dlp:~#
sar -n DEV

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

00:28:29     LINUX RESTART      (2 CPU)

00:30:01        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
00:40:08           lo      1.31      1.31      2.11      2.11      0.00      0.00      0.00      0.00
00:40:08       enp1s0     11.33      5.71     84.34      0.44      0.00      0.00      0.00      0.00
00:50:09           lo      2.22      2.22      3.78      3.78      0.00      0.00      0.00      0.00
00:50:09       enp1s0      1.36      0.42      0.59      2.94      0.00      0.00      0.00      0.00
.....
.....

# load avarage

root@dlp:~#
sar -q

Linux 6.12.43+deb13-amd64 (dlp.srv.world)       09/18/2025      _x86_64_        (2 CPU)

11:14:08 AM  LINUX RESTART      (2 CPU)

11:20:07 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
11:30:07 AM         0       114      0.00      0.00      0.00         0
11:40:07 AM         0       114      0.00      0.00      0.00         0
11:50:01 AM         0       113      0.00      0.00      0.00         0
12:00:07 PM         2       114      0.00      0.00      0.00         0
.....
.....
[2] Display past statistics with specifying a log file.
Log files are stored under the [/var/log/sa] directory by default.
# display all statistics by a log file

root@dlp:~#
sar -A -f /var/log/sysstat/sa09

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

00:28:29     LINUX RESTART      (2 CPU)

00:30:01        CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
00:40:08        all      0.88      0.05      0.36      0.50      0.00      0.00      0.00      0.00      0.00     98.21
00:40:08          0      0.95      0.00      0.37      0.40      0.00      0.00      0.00      0.00      0.00     98.28
00:40:08          1      0.82      0.09      0.34      0.60      0.00      0.00      0.00      0.00      0.00     98.15
00:50:09        all      0.35      0.04      0.10      0.10      0.00      0.00      0.01      0.00      0.00     99.40

.....
.....

03:00:09         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:10:09         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:20:09         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:30:09         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:40:09         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

# display the load average with specifying times by a log file

root@dlp:~#
sar -q -s 01:00:00 -e 02:00:00 -f /var/log/sysstat/sa09

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

01:00:09      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
01:10:09            4       179      0.00      0.00      0.00         0
01:20:09            2       195      0.00      0.02      0.00         0
01:30:04            1       191      0.01      0.01      0.00         0
01:40:09            2       226      0.03      0.06      0.02         0
01:50:09            1       220      0.06      0.04      0.00         0
Average:            2       202      0.02      0.03      0.00         0
[3] Display current statistics.
# display CPU utilization per a second 3 times

root@dlp:~#
sar -u 1 3

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

03:44:04        CPU     %user     %nice   %system   %iowait    %steal     %idle
03:44:05        all      0.00      0.00      0.00      0.00      0.00    100.00
03:44:06        all      0.00      0.00      0.50      0.00      0.00     99.50
03:44:07        all      0.00      0.00      0.50      0.00      0.00     99.50
Average:        all      0.00      0.00      0.33      0.00      0.00     99.67

# display I/O and network per 2 seconds 5 times

root@dlp:~#
sar -b -n DEV 2 5

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

03:44:22          tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
03:44:24         1.00      0.00      1.00      0.00      0.00     12.00      0.00

03:44:22        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
03:44:24           lo      6.00      6.00      6.85      6.85      0.00      0.00      0.00      0.00
03:44:24       enp1s0      1.00      1.00      0.32      0.23      0.00      0.00      0.00      0.00

03:44:24          tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
03:44:26         0.00      0.00      0.00      0.00      0.00      0.00      0.00

.....
.....

03:44:30        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
03:44:32           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:44:32       enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00

Average:          tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
Average:         1.80      0.00      1.80      0.00      0.00     52.80      0.00

Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      3.60      3.60      4.80      4.80      0.00      0.00      0.00      0.00
Average:       enp1s0      3.00      2.40      3.21      0.28      0.00      0.00      0.00      0.00
[4] SysStat packages includes other commands not only [Sar] command, so it's possible to display current statistics with them like follows.
# display I/O with Mega bytes per 2 seconds

root@dlp:~#
iostat -mx -d 2

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

Device            r/s     rMB/s   rrqm/s  %rrqm r_await rareq-sz     w/s     wMB/s   wrqm/s  %wrqm w_await wareq-sz     d/s     dMB/s   drqm/s  %drqm d_await dareq-sz     f/s f_await  aqu-sz  %util
dm-0             1.22      0.04     0.00   0.00    0.26    36.72    9.48      0.24     0.00   0.00    0.74    25.90    0.16      1.71     0.00   0.00    0.08 10904.72    0.00    0.00    0.01   0.31
vda              0.98      0.05     0.29  22.69    0.29    48.68    5.40      0.24     4.12  43.26    0.99    45.51    0.16      1.87     0.00   0.00    0.08 11675.90    2.50    1.07    0.01   0.29


Device            r/s     rMB/s   rrqm/s  %rrqm r_await rareq-sz     w/s     wMB/s   wrqm/s  %wrqm w_await wareq-sz     d/s     dMB/s   drqm/s  %drqm d_await dareq-sz     f/s f_await  aqu-sz  %util
dm-0             0.00      0.00     0.00   0.00    0.00     0.00    6.50      0.03     0.00   0.00    0.00     4.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.00   0.00
vda              0.00      0.00     0.00   0.00    0.00     0.00    5.50      0.03     1.00  15.38    0.27     4.73    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.00   0.00

.....
.....

# display all CPU utilization per 2 seconds 3 times

root@dlp:~#
mpstat -P ALL 2 3

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

03:45:23     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:45:25     all    1.50    0.00    0.25    0.00    0.00    0.00    0.00    0.00    0.00   98.25
03:45:25       0    1.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   98.50
03:45:25       1    2.01    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   97.99

03:45:25     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:45:27     all    0.00    0.00    0.25    0.50    0.00    0.00    0.00    0.00    0.00   99.25
03:45:27       0    0.00    0.00    0.00    1.01    0.00    0.00    0.00    0.00    0.00   98.99
03:45:27       1    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   99.50

03:45:27     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:45:29     all    0.25    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.75
03:45:29       0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:45:29       1    0.50    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.50

Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
Average:     all    0.58    0.00    0.17    0.17    0.00    0.00    0.00    0.00    0.00   99.08
Average:       0    0.33    0.00    0.17    0.33    0.00    0.00    0.00    0.00    0.00   99.17
Average:       1    0.84    0.00    0.17    0.00    0.00    0.00    0.00    0.00    0.00   99.00

# display memory utilization of specific process per a second 3 times

root@dlp:~#
pidstat -r -p 6860 1 3

Linux 7.0.0-15-generic (dlp.srv.world)  06/09/26        _x86_64_        (2 CPU)

03:46:20      UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
03:46:21      105      6860      0.00      0.00 1979976  115172   3.31  prometheus
03:46:22      105      6860      0.00      0.00 1979976  115172   3.31  prometheus
03:46:23      105      6860      0.00      0.00 1979976  115172   3.31  prometheus
Average:      105      6860      0.00      0.00 1979976  115172   3.31  prometheus

# display CIFS statistics with Mega bytes per a 1 second 3 times

root@dlp:~#
cifsiostat -m 1 3

Filesystem:               rB/s         wB/s    rops/s    wops/s         fo/s         fc/s         fd/s
\\10.0.0.100\tmp          0.00        20.93      0.00      0.00         0.00         0.00         0.00
.....
.....
Matched Content