Debian 13 trixie

SysStat : How to use2025/09/18

 

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.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     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:30:07 AM     all      0.00      0.00      0.00      0.01      0.00     99.99
11:40:07 AM     all      0.00      0.00      0.01      0.02      0.00     99.97
11:50:01 AM     all      0.00      0.00      0.00      0.01      0.00     99.99
12:00:07 PM     all      0.00      0.00      0.00      0.01      0.00     99.99
.....
.....

# memory

root@dlp:~#
sar -r

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 kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
11:30:07 AM   3557940   3667504    100780      2.51     17040    292612     35344      0.63     88472    234204       140
11:40:07 AM   3557940   3667716    100520      2.50     17156    292712     35344      0.63     88468    234356        84
11:50:01 AM   3557940   3667828    100408      2.50     17268    292712     35344      0.63     88468    234468        84
12:00:07 PM   3557940   3667948    100288      2.50     17396    292704     38352      0.68     89308    234588        92
.....
.....

# I/O

root@dlp:~#
sar -b

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       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
11:30:07 AM      0.37      0.00      0.37      0.00      0.03      4.32      0.00
11:40:07 AM      5.12      0.01      0.30      4.81      0.31      3.01  92805.52
11:50:01 AM      0.21      0.00      0.21      0.00      0.00      2.04      0.00
12:00:07 PM      0.22      0.00      0.22      0.00      0.00      2.11      0.00
.....
.....

# network

root@dlp:~#
sar -n DEV

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     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
11:30:07 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:30:07 AM    enp1s0      0.63      0.01      0.03      0.00      0.00      0.00      0.00      0.00
11:40:07 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:40:07 AM    enp1s0      0.59      0.00      0.03      0.00      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/sa18

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     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
11:30:07 AM     all      0.00      0.00      0.00      0.01      0.00      0.00      0.00      0.00      0.00     99.99
11:30:07 AM       0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00    100.00
11:30:07 AM       1      0.00      0.00      0.00      0.02      0.00      0.00      0.00      0.00      0.00     99.98
11:40:07 AM     all      0.00      0.00      0.01      0.02      0.00      0.00      0.00      0.00      0.00     99.97

.....
.....

11:20:07 AM  %smem-10  %smem-60 %smem-300     %smem  %fmem-10  %fmem-60 %fmem-300     %fmem
11:30:07 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:40:07 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:50:01 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:00:07 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:10:06 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:20:07 PM      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 11:00:00 -e 12:00:00 -f /var/log/sysstat/sa18

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
Average:            0       114      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.43+deb13-amd64 (dlp.srv.world)       09/18/2025      _x86_64_        (2 CPU)

12:26:51 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:26:52 PM     all      0.00      0.00      0.00      0.50      0.00     99.50
12:26:53 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
12:26:54 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
Average:        all      0.00      0.00      0.00      0.17      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.43+deb13-amd64 (dlp.srv.world)       09/18/2025      _x86_64_        (2 CPU)

12:27:14 PM       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
12:27:16 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00

12:27:14 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
12:27:16 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:27:16 PM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00

.....
.....

12:27:22 PM       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
12:27:24 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00

12:27:22 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
12:27:24 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:27:24 PM    enp1s0      1.50      0.00      0.72      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      1.90      0.00      0.99      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.43+deb13-amd64 (dlp.srv.world)       09/18/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             1.93      0.05     0.00   0.00    0.21    24.53    1.54      0.03     0.00   0.00    0.49    19.32    0.62      5.81     0.00   0.00    0.04  9543.00    0.00    0.00    0.00   0.06
dm-1             0.02      0.00     0.00   0.00    0.00    15.75    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              1.61      0.05     0.41  20.24    0.14    30.27    0.79      0.03     0.77  49.32    0.86    37.58    0.64      5.99     0.00   0.00    0.04  9640.30    0.21    2.00    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.43+deb13-amd64 (dlp.srv.world)       09/18/2025      _x86_64_        (2 CPU)

12:28:32 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
12:28:34 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
12:28:34 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
12:28:34 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

12:28:34 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
12:28:36 PM  all    0.00    0.00    0.25    0.00    0.00    0.00    0.00    0.00    0.00   99.75
12:28:36 PM    0    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   99.50
12:28:36 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

12:28:36 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
12:28:38 PM  all    0.00    0.00    0.00    0.25    0.00    0.00    0.00    0.00    0.00   99.75
12:28:38 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
12:28:38 PM    1    0.00    0.00    0.00    0.50    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.00    0.00    0.08    0.08    0.00    0.00    0.00    0.00    0.00   99.83
Average:       0    0.00    0.00    0.17    0.00    0.00    0.00    0.00    0.00    0.00   99.83
Average:       1    0.00    0.00    0.00    0.17    0.00    0.00    0.00    0.00    0.00   99.83

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

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

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

12:29:16 PM   UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
12:29:17 PM     0       713      0.00      0.00   11768    7896   0.20  sshd
12:29:18 PM     0       713      0.00      0.00   11768    7896   0.20  sshd
12:29:19 PM     0       713      0.00      0.00   11768    7896   0.20  sshd
Average:        0       713      0.00      0.00   11768    7896   0.20  sshd

# 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