Rocky_Linux_8
Sponsored Link

SysStat : How to use2021/08/05

 
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-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

11:37:25     LINUX RESTART      (2 CPU)

11:40:06 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:50:15 AM     all      0.01      0.00      0.01      0.00      0.00     99.98
12:00:15 PM     all      0.01      0.00      0.02      0.00      0.00     99.98
12:10:15 PM     all      0.01      0.00      0.02      0.00      0.00     99.97
12:20:15 PM     all      0.01      0.07      0.03      0.00      0.00     99.90
Average:        all      0.00      0.01      0.02      0.00      0.00     99.97

# memory

[root@dlp ~]#
sar -r

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

11:37:25     LINUX RESTART      (2 CPU)

11:40:06 AM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
11:50:15 AM   3246140   3409560    580192     15.16      3164    356392    275828      3.96    217540    229480         0
12:00:15 PM   3246772   3410204    579560     15.15      3164    356396    277080      3.97    217708    228896         0
12:10:15 PM   3246312   3409868    580020     15.16      3164    356520    273924      3.93    217984    229028         0
12:20:15 PM   3246308   3409872    580024     15.16      3164    356520    273924      3.93    232472    214656         0
Average:      3246280   3409959    580052     15.16      3164    356638    274199      3.93    228905    218143         0

# I/O

[root@dlp ~]#
sar -b

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

11:37:25     LINUX RESTART      (2 CPU)

11:40:06 AM       tps      rtps      wtps   bread/s   bwrtn/s
11:50:15 AM      0.07      0.00      0.07      0.00      0.80
12:00:15 PM      0.12      0.00      0.12      0.00      1.49
12:10:15 PM      0.12      0.01      0.11      0.36      1.59
12:20:15 PM      0.21      0.00      0.21      0.00      7.73
Average:         0.11      0.00      0.11      0.08      1.82

# network

[root@dlp ~]#
sar -n DEV

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

11:37:25     LINUX RESTART      (2 CPU)

11:40:06 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
11:50:15 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11:50:15 AM    enp1s0      0.63      0.05      0.05      0.00      0.00      0.00      0.00      0.00
12:00:15 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:00:15 PM    enp1s0      0.60      0.04      0.05      0.00      0.00      0.00      0.00      0.00
12:10:15 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:10:15 PM    enp1s0      0.62      0.03      0.05      0.00      0.00      0.00      0.00      0.00
12:20:15 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:20:15 PM    enp1s0      0.71      0.16      0.13      0.02      0.00      0.00      0.00      0.00
12:30:15 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:30:15 PM    enp1s0      0.61      0.01      0.05      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.65      0.03      0.06      0.00      0.00      0.00      0.00      0.00

# load avarage

[root@dlp ~]#
sar -q

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

11:37:25     LINUX RESTART      (2 CPU)

11:40:06 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
11:50:15 AM         5       141      0.00      0.00      0.00         0
12:00:15 PM         1       141      0.00      0.00      0.00         0
12:10:15 PM         0       141      0.00      0.00      0.00         0
Average:            0       141      0.01      0.00      0.00         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/sa05

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

11:37:25     LINUX RESTART      (2 CPU)

11:40:06 AM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
11:50:15 AM     all      0.01      0.00      0.00      0.00      0.00      0.01      0.00      0.00      0.00     99.98
11:50:15 AM       0      0.01      0.00      0.00      0.00      0.00      0.01      0.00      0.00      0.00     99.98

.....
.....

01:30:15 PM     CPU   total/s   dropd/s squeezd/s  rx_rps/s flw_lim/s
01:40:15 PM     all      0.73      0.00      0.00      0.00      0.00
01:40:15 PM       0      0.00      0.00      0.00      0.00      0.00
01:40:15 PM       1      0.73      0.00      0.00      0.00      0.00
Average:        all      0.65      0.00      0.00      0.00      0.00
Average:          0      0.00      0.00      0.00      0.00      0.00
Average:          1      0.65      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-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

01:47:24 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
01:47:25 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
01:47:26 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
01:47:27 PM     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 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

01:47:38 PM       tps      rtps      wtps   bread/s   bwrtn/s
01:47:40 PM      0.00      0.00      0.00      0.00      0.00

01:47:38 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
01:47:40 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:47:40 PM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00

01:47:40 PM       tps      rtps      wtps   bread/s   bwrtn/s
01:47:42 PM      0.00      0.00      0.00      0.00      0.00

01:47:40 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
01:47:42 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:47:42 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-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 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              1.89    0.31      0.04      0.01     0.00     0.09   0.13  21.29    0.14    6.79   0.00    21.62    35.42   1.38   0.30
dm-0             1.83    0.40      0.03      0.01     0.00     0.00   0.00   0.00    0.14    5.51   0.00    19.48    28.54   1.36   0.30
dm-1             0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.16    0.00   0.00    22.65     0.00   0.14   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-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

01:48:57 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:48:59 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:48:59 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:48:59 PM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

01:48:59 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:49:01 PM  all    0.25    0.00    0.00    0.00    0.25    0.00    0.00    0.00    0.00   99.50
01:49:01 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:49:01 PM    1    0.50    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.00

01:49:01 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
01:49:03 PM  all    0.00    0.00    0.00    0.00    0.25    0.00    0.00    0.00    0.00   99.75
01:49:03 PM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:49:03 PM    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.08    0.00    0.00    0.00    0.17    0.00    0.00    0.00    0.00   99.75
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.17    0.00    0.00    0.00    0.33    0.00    0.00    0.00    0.00   99.50

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

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

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _x86_64_        (2 CPU)

01:50:01 PM   UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
01:50:02 PM     0       854      0.00      0.00  294504   40468   1.06  firewalld
01:50:03 PM     0       854      0.00      0.00  294504   40468   1.06  firewalld
01:50:04 PM     0       854      0.00      0.00  294504   40468   1.06  firewalld
Average:        0       854      0.00      0.00  294504   40468   1.06  firewalld

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

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

Linux 4.18.0-305.3.1.el8_4.x86_64 (dlp.srv.world)       08/05/2021      _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