Debian 10 Buster
Sponsored Link

SysStat : How to Use2019/08/08

 
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.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

02:27:56 PM  LINUX RESTART      (2 CPU)

02:35:01 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
02:45:01 PM     all      3.87      0.00      3.18      8.53      0.03     84.39
02:55:01 PM     all      3.43      0.00      6.04     25.27      0.00     65.26
.....
.....
03:55:01 PM     all      0.69      0.00      0.98      7.97      0.00     90.36
Average:        all      1.46      0.00      1.90      9.91      0.01     86.73

# memory

root@dlp:~#
sar -r

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

02:27:56 PM  LINUX RESTART      (2 CPU)

02:35:01 PM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
02:45:01 PM   3176392   3614980    161576      4.00     40632    588252   1117132     13.56    285096    473024     30476
.....
.....
03:55:01 PM   2894808   3470984    289140      7.15    130416    638840   1356028     16.46    505068    513336        28
Average:      2961894   3504414    259840      6.43    104306    630592   1292892     15.70    449082    507818      3828

# I/O

root@dlp:~#
sar -b

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

02:27:56 PM  LINUX RESTART      (2 CPU)

02:35:01 PM       tps      rtps      wtps   bread/s   bwrtn/s
02:45:01 PM     36.23      4.58     31.65    547.18   2403.07
.....
.....
03:55:01 PM     19.39      0.00     19.39      0.00    467.76
Average:        25.92      0.59     25.33     69.15    855.43

# network

root@dlp:~#
sar -n DEV

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

02:27:56 PM  LINUX RESTART      (2 CPU)

02:35:01 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
02:45:01 PM        lo      0.01      0.01      0.00      0.00      0.00      0.00      0.00      0.00
.....
.....
03:55:01 PM        lo      6.65      6.65      0.41      0.41      0.00      0.00      0.00      0.00
03:55:01 PM      ens2      2.12      0.55      0.22      0.13      0.00      0.00      0.00      0.00
Average:           lo      4.11      4.11      0.26      0.26      0.00      0.00      0.00      0.00
Average:         ens2      2.82      0.99      9.34      0.24      0.00      0.00      0.00      0.0

# load avarage

root@dlp:~#
sar -q

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

02:27:56 PM  LINUX RESTART      (2 CPU)

02:35:01 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
02:45:01 PM         0       141      0.89      0.56      0.29         0
.....
.....
03:45:01 PM         0       200      0.41      0.35      0.34         1
03:55:01 PM         0       200      0.46      0.40      0.37         0
Average:            0       184      0.47      0.48      0.44         0

[2] Display past statics with specifying a log file.
Log files are stored under the /var/log/sysstat directory.
# display all statics by a log file

root@dlp:~#
sar -A -f /var/log/sysstat/sa08

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

02:27:56 PM  LINUX RESTART      (2 CPU)

02:35:01 PM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
02:45:01 PM     all      3.87      0.00      3.13      8.53      0.03      0.00      0.06      0.00      0.00     84.39
02:45:01 PM       0      4.02      0.00      3.02      8.11      0.00      0.00      0.04      0.00      0.00     84.80
.....
.....
Average:        CPU   total/s   dropd/s squeezd/s  rx_rps/s flw_lim/s
Average:        all      6.93      0.00      0.01      0.00      0.00
Average:          0      1.90      0.00      0.01      0.00      0.00
Average:          1      5.03      0.00      0.01      0.00      0.00

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

root@dlp:~#
sar -q -s 15:00:00 -e 16:00:00 -f /var/log/sysstat/sa08

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

03:05:02 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
03:15:01 PM         0       200      0.32      0.32      0.44         0
03:25:01 PM         0       200      0.25      0.23      0.33         0
03:35:01 PM         0       200      0.67      0.43      0.37         0
03:45:01 PM         0       200      0.41      0.35      0.34         1
03:55:01 PM         0       200      0.46      0.40      0.37         0
Average:            0       200      0.42      0.35      0.37         0
[3] Display current statics.
# display CPU utilization per a second 3 times

root@dlp:~#
sar -u 1 3

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

04:03:50 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
04:03:51 PM     all      0.50      0.00      1.50      5.50      0.00     92.50
04:03:52 PM     all      0.00      0.00      1.01      3.54      0.00     95.45
04:03:53 PM     all      0.50      0.00      1.50      9.50      0.00     88.50
Average:        all      0.33      0.00      1.34      6.19      0.00     92.14

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

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

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

04:04:07 PM       tps      rtps      wtps   bread/s   bwrtn/s
04:04:09 PM     10.50      0.00     10.50      0.00    188.00

04:04:07 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
04:04:09 PM        lo      5.00      5.00      0.28      0.28      0.00      0.00      0.00      0.00
04:04:09 PM      ens2      1.50      0.00      0.08      0.00      0.00      0.00      0.00      0.00

.....
.....

04:04:15 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
04:04:17 PM        lo     15.00     15.00      1.01      1.01      0.00      0.00      0.00      0.00
04:04:17 PM      ens2      6.50      3.50      1.50      1.16      0.00      0.00      0.00      0.00

Average:          tps      rtps      wtps   bread/s   bwrtn/s
Average:        17.00      0.00     17.00      0.00    307.20

Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      9.00      9.00      0.66      0.66      0.00      0.00      0.00      0.00
Average:         ens2      4.30      2.60      0.77      0.99      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.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _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.51   22.99      0.05      0.37     0.00    12.50   0.00  35.23    0.21    8.56   0.01    33.65    16.46   0.35   0.86
dm-0             1.45   35.49      0.05      0.39     0.00     0.00   0.00   0.00    0.20    5.71   0.20    33.83    11.17   5.09  18.80
dm-1             0.02    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.03    0.00   0.00    24.21     0.00   0.03   0.00
.....
.....

# display all CPU utilization per 2 seconds 3 times

root@dlp:~#
mpstat -P ALL 2 3

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

04:05:17 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
04:05:19 PM  all    0.75    0.00    1.00    8.98    0.00    0.25    0.00    0.00    0.00   89.03
04:05:19 PM    0    1.00    0.00    1.00   13.50    0.00    0.00    0.00    0.00    0.00   84.50
04:05:19 PM    1    0.50    0.00    1.00    4.48    0.00    0.50    0.00    0.00    0.00   93.53

.....
.....

04:05:21 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
04:05:23 PM  all    0.74    0.00    2.23   10.67    0.00    0.00    0.25    0.00    0.00   86.10
04:05:23 PM    0    0.99    0.00    1.49   20.30    0.00    0.00    0.00    0.00    0.00   77.23
04:05:23 PM    1    0.50    0.00    2.99    1.00    0.00    0.00    0.50    0.00    0.00   95.02

Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
Average:     all    0.67    0.00    1.66   11.72    0.00    0.08    0.08    0.00    0.00   85.79
Average:       0    0.83    0.00    1.00   20.93    0.00    0.00    0.00    0.00    0.00   77.24
Average:       1    0.50    0.00    2.33    2.50    0.00    0.17    0.17    0.00    0.00   94.34

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

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

Linux 4.19.0-5-amd64 (dlp.srv.world)    08/08/2019      _x86_64_        (2 CPU)

04:06:39 PM   UID       PID  minflt/s  majflt/s     VSZ     RSS   %MEM  Command
04:06:40 PM   998       383      0.00      0.00  165764   30328   0.75  netdata
04:06:41 PM   998       383      0.00      0.00  165764   30328   0.75  netdata
04:06:42 PM   998       383      1.00      0.00  165764   30328   0.75  netdata
Average:      998       383      0.33      0.00  165764   30328   0.75  netdata
.....
.....

# display CIFS statics 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