CentOS Stream 8
Sponsored Link

SysStat : How to use2021/03/17

 
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 statics reports.
# CPU

[root@dlp ~]#
sar -u

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
10:55:00 PM     all      0.00      0.00      0.07      0.03      0.00     99.90
11:00:00 PM     all      0.00      0.00      0.01      0.00      0.00     99.98
11:05:00 PM     all      0.01      0.09      0.07      0.01      0.00     99.82
Average:        all      0.01      0.03      0.05      0.01      0.00     99.90

# memory

[root@dlp ~]#
sar -r

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
10:55:00 PM   7337956   7504384    616056      7.75      3164    375340    336364      3.03    204492    260952         4
11:00:00 PM   7338132   7504556    615880      7.74      3164    375344    335544      3.02    204520    261116         0
11:05:00 PM   7336600   7504152    617412      7.76      3164    376476    329228      2.97    223452    243628         0
Average:      7337563   7504364    616449      7.75      3164    375720    333712      3.01    210821    255232         1

# I/O

[root@dlp ~]#
sar -b

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM       tps      rtps      wtps   bread/s   bwrtn/s
10:55:00 PM      1.54      0.04      1.50      9.65    196.75
11:00:00 PM      0.14      0.00      0.14      0.00      1.74
11:05:00 PM      0.66      0.04      0.63      7.44     20.69
Average:         0.78      0.03      0.75      5.70     73.06

# network

[root@dlp ~]#
sar -n DEV

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
10:55:00 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:55:00 PM    enp1s0      0.61      0.06      0.03      0.00      0.00      0.00      0.00      0.00
11:00:00 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:00:00 PM    enp1s0      0.64      0.05      0.08      0.00      0.00      0.00      0.00      0.00
11:05:00 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:05:00 PM    enp1s0      0.71      0.22      0.09      0.02      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.65      0.11      0.07      0.01      0.00      0.00      0.00      0.00

# load avarage

[root@dlp ~]#
sar -q

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
10:55:00 PM         1       166      0.00      0.04      0.02         0
11:00:00 PM         0       169      0.00      0.01      0.00         0
11:05:00 PM         0       170      0.00      0.00      0.00         0
Average:            0       168      0.00      0.02      0.01         0
[2] Display past statics with specifying a log file.
Log files are stored under the [/var/log/sa] directory by default.
# display all statics by a log file

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

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
10:55:00 PM     all      0.00      0.00      0.02      0.03      0.00      0.05      0.01      0.00      0.00     99.90
10:55:00 PM       0      0.00      0.00      0.01      0.00      0.00      0.00      0.00      0.00      0.00     99.99

.....
.....

11:05:00 PM       2      0.71      0.00      0.00      0.00      0.00
11:10:00 PM     all      0.62      0.00      0.00      0.00      0.00
11:10:00 PM       2      0.62      0.00      0.00      0.00      0.00
Average:        all      0.64      0.00      0.00      0.00      0.00
Average:          2      0.64      0.00      0.00      0.00      0.00

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

[root@dlp ~]#
sar -q -s 22:00:00 -e 00:00:00 -f /var/log/sa/sa16

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

22:49:41     LINUX RESTART      (4 CPU)

10:50:00 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
10:55:00 PM         1       166      0.00      0.04      0.02         0
11:00:00 PM         0       169      0.00      0.01      0.00         0
11:05:00 PM         0       170      0.00      0.00      0.00         0
11:10:00 PM         0       167      0.00      0.00      0.00         0
Average:            0       168      0.00      0.01      0.01         0
[3] Display current statics.
# display CPU utilization per a second 3 times

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

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

11:13:02 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:13:03 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
11:13:04 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
11:13:05 PM     all      0.00      0.00      0.25      0.00      0.00     99.75
Average:        all      0.00      0.00      0.08      0.00      0.00     99.92

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

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

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

11:13:19 PM       tps      rtps      wtps   bread/s   bwrtn/s
11:13:21 PM      0.00      0.00      0.00      0.00      0.00

11:13:19 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
11:13:21 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:13:21 PM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00

.....
.....

11:13:27 PM       tps      rtps      wtps   bread/s   bwrtn/s
11:13:29 PM      0.00      0.00      0.00      0.00      0.00

11:13:27 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
11:13:29 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:13:29 PM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00

Average:          tps      rtps      wtps   bread/s   bwrtn/s
Average:         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
[4] SysStat packages includes other commands not only[Sar] command, so it's possible to display current statics with them like follows.
# display I/O with Mega bytes per 2 seconds

[root@dlp ~]#
iostat -mx -d 2

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
vda              7.17    1.00      0.22      0.05     0.02     0.26   0.27  20.72    0.10    6.62   0.01    31.59    47.49   0.80   0.65
dm-0             5.74    1.25      0.19      0.05     0.00     0.00   0.00   0.00    0.11    5.76   0.01    34.73    37.85   0.92   0.64
dm-1             0.06    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.15    0.00   0.00    22.65     0.00   0.19   0.00

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
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
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
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

.....
.....

# display all CPU utilization per 2 seconds 3 times

[root@dlp ~]#
mpstat -P ALL 2 3

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

11:14:32 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11:14:34 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:14:34 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:14:34 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:14:34 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:14:34 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

.....
.....

11:14:36 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11:14:38 PM  all    0.00    0.00    0.00    0.00    0.12    0.00    0.00    0.00    0.00   99.88
11:14:38 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:14:38 PM    1    0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50
11:14:38 PM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11:14:38 PM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
Average:     all    0.00    0.00    0.04    0.00    0.08    0.00    0.00    0.00    0.00   99.88
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
Average:       2    0.00    0.00    0.17    0.00    0.00    0.00    0.00    0.00    0.00   99.83
Average:       3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

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

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

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 CPU)

11:16:04 PM   UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
11:16:05 PM     0       940      0.00      0.00   92312    7164   0.09  sshd
11:16:06 PM     0       940      0.00      0.00   92312    7164   0.09  sshd
11:16:07 PM     0       940      0.00      0.00   92312    7164   0.09  sshd
Average:        0       940      0.00      0.00   92312    7164   0.09  sshd

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

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

Linux 4.18.0-277.el8.x86_64 (dlp.srv.world)     03/16/2021      _x86_64_        (4 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