CentOS Stream 10
Sponsored Link

SysStat : How to use2025/02/07

 

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 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

08:44:30 AM  LINUX RESTART      (2 CPU)

08:50:00 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
09:00:00 AM     all      0.01      0.00      0.02      0.01      0.00     99.96
09:10:00 AM     all      0.00      0.00      0.04      0.00      0.00     99.96
Average:        all      0.01      0.00      0.03      0.00      0.00     99.96

# memory

[root@dlp ~]#
sar -r

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

08:44:30 AM  LINUX RESTART      (2 CPU)

08:50:00 AM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
09:00:00 AM   3140204   3263248    201356      5.39      4224    320300    287964      4.18    210284    213460         0
09:10:00 AM   3143292   3266524    198100      5.30      4224    320488    284116      4.13    206728    213628         0
Average:      3141748   3264886    199728      5.34      4224    320394    286040      4.15    208506    213544         0

# I/O

[root@dlp ~]#
sar -b

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

08:44:30 AM  LINUX RESTART      (2 CPU)

08:50:00 AM       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
09:00:00 AM      0.62      0.01      0.18      0.43      0.27      2.22  85891.42
09:10:00 AM      0.12      0.02      0.11      0.00      0.65      1.38      0.00
Average:         0.37      0.01      0.14      0.22      0.46      1.80  42946.43

# network

[root@dlp ~]#
sar -n DEV

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

08:44:30 AM  LINUX RESTART      (2 CPU)

08:50:00 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
09:00:00 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:00:00 AM    enp1s0      0.89      0.05      0.10      0.00      0.00      0.00      0.00      0.00
09:00:00 AM    enp8s0      0.84      0.00      0.10      0.00      0.00      0.00      0.00      0.00
09:10:00 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:10:00 AM    enp1s0      0.79      0.05      0.08      0.00      0.00      0.00      0.00      0.00
09:10:00 AM    enp8s0      0.74      0.00      0.07      0.00      0.00      0.00      0.00      0.00
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:       enp1s0      0.84      0.05      0.09      0.00      0.00      0.00      0.00      0.00
Average:       enp8s0      0.79      0.00      0.08      0.00      0.00      0.00      0.00      0.00

# load avarage

[root@dlp ~]#
sar -q

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

08:44:30 AM  LINUX RESTART      (2 CPU)

08:50:00 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
09:00:00 AM         0       164      0.00      0.00      0.00         0
09:10:00 AM         0       162      0.00      0.00      0.00         0
Average:            0       163      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.
[root@dlp ~]#
ll /var/log/sa

total 8
-rw-r--r--. 1 root root 5948 Feb  7 09:10 sa07

# display all statistics by a log file

[root@dlp ~]#
sar -A -f /var/log/sa/sa07

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

08:44:30 AM  LINUX RESTART      (2 CPU)

08:50:00 AM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
09:00:00 AM     all      0.01      0.00      0.00      0.01      0.00      0.01      0.01      0.00      0.00     99.96
09:00:00 AM       0      0.01      0.00      0.01      0.02      0.00      0.01      0.01      0.00      0.00     99.95
09:00:00 AM       1      0.01      0.00      0.00      0.00      0.00      0.01      0.01      0.00      0.00     99.97

.....
.....

09:00:00 AM     CPU   total/s   dropd/s squeezd/s  rx_rps/s flw_lim/s   blg_len
09:10:00 AM     all      1.54      0.00      0.00      0.00      0.00         0
09:10:00 AM       0      1.31      0.00      0.00      0.00      0.00         0
09:10:00 AM       1      0.23      0.00      0.00      0.00      0.00         0

Average:        CPU   total/s   dropd/s squeezd/s  rx_rps/s flw_lim/s   blg_len
Average:        all      1.63      0.00      0.00      0.00      0.00         0
Average:          0      1.10      0.00      0.00      0.00      0.00         0
Average:          1      0.53      0.00      0.00      0.00      0.00         0

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

[root@dlp ~]#
sar -q -s 09:00:00 -e 10:00:00 -f /var/log/sa/sa07

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

09:00:00 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
09:10:00 AM         0       162      0.00      0.00      0.00         0
Average:            0       162      0.00      0.00      0.00         0
[3] Display current statistics.
# display CPU utilization per a second 3 times

[root@dlp ~]#
sar -u 1 3

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

09:17:45 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
09:17:46 AM     all      0.00      0.00      0.00      0.00      0.00    100.00
09:17:47 AM     all      0.00      0.00      0.50      0.00      0.00     99.50
09:17:48 AM     all      0.00      0.00      0.00      0.00      0.00    100.00
Average:        all      0.00      0.00      0.17      0.00      0.00     99.83

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

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

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

09:18:13 AM       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
09:18:15 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00

09:18:13 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
09:18:15 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:18:15 AM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00
09:18:15 AM    enp8s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00

.....
.....

09:18:21 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
09:18:23 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:18:23 AM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00
09:18:23 AM    enp8s0      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:         0.00      0.00      0.00      0.00      0.00      0.00      0.00

Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:       enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00
Average:       enp8s0      0.50      0.00      0.03      0.00      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 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _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             3.49      0.11     0.00   0.00    0.10    31.21    0.76      0.01     0.00   0.00    1.54    14.41    0.10      9.56     0.00   0.00    2.47 99220.05    0.00    0.00    0.00   0.07
dm-1             0.04      0.00     0.00   0.00    0.10    22.28    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.00   0.00
vda              3.69      0.13     0.01   0.22    0.11    36.71    0.63      0.01     0.14  18.23    1.73    18.83    0.10      9.77     0.00   1.15    1.76 99489.79    0.16    2.25    0.00   0.06


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    0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.00    0.00    0.00    0.00   0.00
dm-1             0.00      0.00     0.00   0.00    0.00     0.00    0.00      0.00     0.00   0.00    0.00     0.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    0.00      0.00     0.00   0.00    0.00     0.00    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 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

09:19:43 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:19:45 AM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
09:19:45 AM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
09:19:45 AM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

09:19:45 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:19:47 AM  all    0.00    0.00    0.00    0.00    0.25    0.00    0.00    0.00    0.00   99.75
09:19:47 AM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
09:19:47 AM    1    0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50

09:19:47 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
09:19:49 AM  all    0.00    0.00    0.00    0.00    0.25    0.00    0.00    0.00    0.00   99.75
09:19:49 AM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
09:19:49 AM    1    0.00    0.00    0.00    0.00    0.50    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.00    0.00    0.00    0.00    0.17    0.00    0.00    0.00    0.00   99.83
Average:       0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
Average:       1    0.00    0.00    0.00    0.00    0.33    0.00    0.00    0.00    0.00   99.67

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

[root@dlp ~]#
pidstat -r -p 914 1 3

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

09:20:41 AM   UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
09:20:42 AM     0       914      0.00      0.00    8064    5708   0.15  sshd
09:20:43 AM     0       914      0.00      0.00    8064    5708   0.15  sshd
09:20:44 AM     0       914      0.00      0.00    8064    5708   0.15  sshd
Average:        0       914      0.00      0.00    8064    5708   0.15  sshd

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

[root@dlp ~]#
cifsiostat -m 1 3

Linux 6.12.0-39.el10.x86_64 (dlp.srv.world)     02/07/2025      _x86_64_        (2 CPU)

Filesystem                    rMB/s        wMB/s    rops/s    wops/s         fo/s         fc/s         fd/s
\\smb.srv.world\Share          0.00         0.00      0.00      0.00         0.00         0.00         0.00

Filesystem                    rMB/s        wMB/s    rops/s    wops/s         fo/s         fc/s         fd/s
\\smb.srv.world\Share          0.00         0.00      0.00      0.00         0.00         0.00         0.00

Filesystem                    rMB/s        wMB/s    rops/s    wops/s         fo/s         fc/s         fd/s
\\smb.srv.world\Share          0.00         0.00      0.00      0.00         0.00         0.00         0.00
Matched Content