CentOS 8
Sponsored Link

SysStat : How to use2019/11/21

 
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-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
03:25:00 AM     all      0.00      0.00      0.08      0.00      0.00     99.91
03:30:00 AM     all      0.00      0.00      0.02      0.00      0.00     99.98
03:35:00 AM     all      0.00      0.00      0.02      0.00      0.00     99.97
Average:        all      0.00      0.00      0.04      0.00      0.00     99.95

# memory

[root@dlp ~]#
sar -r

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
03:25:00 AM   7587120   7565308    412836      5.16      3268    193008    352712      3.16    133480    136796         0
03:30:00 AM   7586944   7565132    413012      5.16      3268    193008    359308      3.22    133452    136796         0
03:35:00 AM   7587132   7565324    412824      5.16      3268    193012    363404      3.26    133696    136564         0
Average:      7587065   7565255    412891      5.16      3268    193009    358475      3.22    133543    136719         0

# I/O

[root@dlp ~]#
sar -b

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM       tps      rtps      wtps   bread/s   bwrtn/s
03:25:00 AM      0.14      0.01      0.13      0.24      1.14
03:30:00 AM      0.07      0.00      0.07      0.00      0.51
03:35:00 AM      0.10      0.00      0.10      0.00      1.03
Average:         0.10      0.00      0.10      0.08      0.89

# network

[root@dlp ~]#
sar -n DEV

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
03:25:00 AM    enp1s0      0.55      0.05      0.03      0.00      0.00      0.00      0.00      0.00
03:25:00 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:30:00 AM    enp1s0      0.52      0.02      0.03      0.00      0.00      0.00      0.00      0.00
03:30:00 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:35:00 AM    enp1s0      0.52      0.02      0.03      0.00      0.00      0.00      0.00      0.00
03:35:00 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:       enp1s0      0.53      0.03      0.03      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

# load avarage

[root@dlp ~]#
sar -q

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
03:25:00 AM         1       152      0.00      0.00      0.00         0
03:30:00 AM         1       151      0.00      0.00      0.00         0
03:35:00 AM         1       152      0.00      0.00      0.00         0
03:40:00 AM         1       150      0.00      0.00      0.00         0
Average:            1       151      0.00      0.00      0.00         0
[2] Display past statics with specifying a log file.
Log files are stored under the [/var/log/sa] directory.
# display all statics by a log file

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

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM     CPU   total/s   dropd/s squeezd/s  rx_rps/s flw_lim/s
03:25:00 AM     all      0.55      0.00      0.00      0.00      0.00
03:25:00 AM       2      0.55      0.00      0.00      0.00      0.00
03:30:00 AM     all      0.52      0.00      0.00      0.00      0.00
03:30:00 AM       2      0.52      0.00      0.00      0.00      0.00
03:35:00 AM     all      0.52      0.00      0.00      0.00      0.00
03:35:00 AM       2      0.52      0.00      0.00      0.00      0.00
03:40:00 AM     all      0.54      0.00      0.00      0.00      0.00
03:40:00 AM       2      0.54      0.00      0.00      0.00      0.00
Average:        all      0.53      0.00      0.00      0.00      0.00
Average:          2      0.53      0.00      0.00      0.00      0.00

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

[root@dlp ~]#
sar -q -s 03:00:00 -e 04:00:00 -f /var/log/sa/sa21

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)
.....
.....
03:20:00 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
03:25:00 AM         1       152      0.00      0.00      0.00         0
03:30:00 AM         1       151      0.00      0.00      0.00         0
03:35:00 AM         1       152      0.00      0.00      0.00         0
03:40:00 AM         1       150      0.00      0.00      0.00         0
Average:            1       151      0.00      0.00      0.00         0
[3] Display current statics.
# display CPU utilization per a second 3 times

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

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)

03:44:38 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
03:44:39 AM     all      0.00      0.00      0.00      0.00      0.00    100.00
03:44:40 AM     all      0.00      0.00      0.50      0.00      0.00     99.50
03:44:41 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 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)

03:45:08 AM       tps      rtps      wtps   bread/s   bwrtn/s
03:45:10 AM      0.00      0.00      0.00      0.00      0.00

03:45:08 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
03:45:10 AM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00
03:45:10 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

.....
.....

03:45:16 AM       tps      rtps      wtps   bread/s   bwrtn/s
03:45:18 AM      0.00      0.00      0.00      0.00      0.00

03:45:16 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
03:45:18 AM    enp1s0      0.50      0.00      0.03      0.00      0.00      0.00      0.00      0.00
03:45:18 AM        lo      0.00      0.00      0.00      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:       enp1s0      0.50      0.00      0.03      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
[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-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _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              1.83    1.05      0.07      0.01     0.01     0.03   0.58   2.87    0.15    1.30   0.00    41.70    11.78   0.27   0.08
dm-0             1.70    1.08      0.06      0.01     0.00     0.00   0.00   0.00    0.14    1.23   0.00    35.86    11.55   0.27   0.07
dm-1             0.04    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.07    0.00   0.00    22.65     0.00   0.15   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.50    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     8.00     0.00   1.00   0.05
dm-0             0.50    0.00      0.00      0.00     0.00     0.00   0.00   0.00    1.00    0.00   0.00     8.00     0.00   1.00   0.05
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-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)

03:46:57 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:46:59 AM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:46:59 AM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:46:59 AM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:46:59 AM    2    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:46:59 AM    3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

.....
.....

03:47:01 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:47:03 AM  all    0.00    0.00    0.12    0.00    0.12    0.00    0.00    0.00    0.00   99.75
03:47:03 AM    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:47:03 AM    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
03:47:03 AM    2    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   99.50
03:47:03 AM    3    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.08    0.00    0.12    0.00    0.00    0.00    0.00   99.79
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.00    0.00    0.00    0.00    0.00  100.00
Average:       2    0.00    0.00    0.33    0.00    0.00    0.00    0.00    0.00    0.00   99.67
Average:       3    0.00    0.00    0.00    0.00    0.50    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 839 1 3

Linux 4.18.0-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _x86_64_        (4 CPU)

03:48:47 AM   UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
03:48:48 AM     0       839      0.00      0.00   92248    6960   0.09  sshd
03:48:49 AM     0       839      0.00      0.00   92248    6960   0.09  sshd
03:48:50 AM     0       839      0.00      0.00   92248    6960   0.09  sshd
Average:        0       839      0.00      0.00   92248    6960   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-80.7.1.el8_0.x86_64 (dlp.srv.world)        11/21/2019      _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