SysStat : How to use2021/09/16 |
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)
|
|||||||||||||||||||
[1] | Display today's statics reports. |
# CPU root@dlp:~# sar -u Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:00:04 AM CPU %user %nice %system %iowait %steal %idle 12:05:08 AM all 0.67 0.01 0.22 2.99 0.00 96.11 12:10:08 AM all 0.18 0.00 0.19 2.09 0.00 97.54 Average: all 0.43 0.00 0.21 2.54 0.00 96.82 # memory root@dlp:~# sar -r Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:00:04 AM kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 12:05:08 AM 2689020 3320692 411716 10.23 95484 736388 1432732 28.49 318984 880416 104 12:10:08 AM 2687988 3320388 412060 10.24 95836 736736 1432732 28.49 319424 881044 200 Average: 2688504 3320540 411888 10.23 95660 736562 1432732 28.49 319204 880730 152 # I/O root@dlp:~# sar -b Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:00:04 AM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 12:05:08 AM 6.80 0.28 6.52 0.00 2.79 54.85 0.00 12:10:08 AM 4.99 0.00 4.99 0.00 0.00 33.97 0.00 Average: 5.90 0.14 5.76 0.00 1.41 44.47 0.00 # network root@dlp:~# sar -n DEV Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:00:04 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 12:05:08 AM lo 7.38 7.38 0.44 0.44 0.00 0.00 0.00 0.00 12:05:08 AM enp1s0 5.64 5.45 0.74 4.03 0.00 0.00 0.00 0.00 12:10:08 AM lo 7.14 7.14 0.44 0.44 0.00 0.00 0.00 0.00 12:10:08 AM enp1s0 4.79 4.28 0.59 0.37 0.00 0.00 0.00 0.00 Average: lo 7.26 7.26 0.44 0.44 0.00 0.00 0.00 0.00 Average: enp1s0 5.22 4.86 0.67 2.21 0.00 0.00 0.00 0.00 # load avarage root@dlp:~# sar -q Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:00:04 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 12:05:08 AM 0 219 0.14 0.07 0.07 1 12:10:08 AM 0 219 0.08 0.09 0.08 0 Average: 0 219 0.11 0.08 0.07 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/sysstat/sa15 Linux 5.10.0-8-amd64 (dlp.srv.world) 09/15/2021 _x86_64_ (2 CPU) 06:37:57 PM LINUX RESTART (2 CPU) 06:40:04 PM CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle 06:50:23 PM all 0.09 0.00 0.02 0.05 0.00 0.00 0.00 0.00 0.00 99.84 06:50:23 PM 0 0.01 0.00 0.02 0.03 0.00 0.00 0.00 0.00 0.00 99.94 06:50:23 PM 1 0.17 0.00 0.02 0.07 0.00 0.00 0.00 0.00 0.00 99.74 07:00:24 PM all 0.00 0.00 0.01 0.07 0.00 0.00 0.00 0.00 0.00 99.92 07:00:24 PM 0 0.00 0.00 0.01 0.13 0.00 0.00 0.00 0.00 0.00 99.85 ..... ..... 11:35:08 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:40:08 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:45:01 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:50:08 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:55:08 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 22:00:00 -e 23:00:00 -f /var/log/sysstat/sa15 Linux 5.10.0-8-amd64 (dlp.srv.world) 09/15/2021 _x86_64_ (2 CPU) 10:00:04 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 10:05:07 PM 0 217 0.06 0.07 0.08 0 10:10:07 PM 0 220 0.01 0.04 0.07 1 10:15:01 PM 0 220 0.03 0.06 0.07 0 10:20:07 PM 0 218 0.07 0.07 0.07 1 10:25:07 PM 0 220 0.01 0.04 0.06 0 10:30:07 PM 0 218 0.06 0.03 0.04 1 10:35:07 PM 0 219 0.27 0.14 0.07 0 10:40:07 PM 0 220 0.04 0.08 0.07 0 10:45:01 PM 0 220 0.01 0.05 0.06 0 10:50:07 PM 0 213 0.08 0.06 0.05 0 10:55:08 PM 3 214 0.36 0.17 0.09 0 Average: 0 218 0.09 0.07 0.07 0 |
[3] | Display current statics. |
# display CPU utilization per a second 3 times root@dlp:~# sar -u 1 3 Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:13:22 AM CPU %user %nice %system %iowait %steal %idle 12:13:23 AM all 0.00 0.00 0.50 3.50 0.00 96.00 12:13:24 AM all 0.50 0.00 0.50 1.00 0.00 98.00 12:13:25 AM all 0.00 0.00 0.00 1.52 0.00 98.48 Average: all 0.17 0.00 0.33 2.01 0.00 97.49 # display I/O and network per 2 seconds 5 times root@dlp:~# sar -b -n DEV 2 5 Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:13:37 AM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 12:13:39 AM 4.00 0.00 4.00 0.00 0.00 16.00 0.00 12:13:37 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 12:13:39 AM lo 10.00 10.00 0.58 0.58 0.00 0.00 0.00 0.00 12:13:39 AM enp1s0 0.50 0.00 0.03 0.00 0.00 0.00 0.00 0.00 ..... ..... 12:13:45 AM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 12:13:47 AM 5.00 0.00 5.00 0.00 0.00 36.00 0.00 12:13:45 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 12:13:47 AM lo 10.00 10.00 0.59 0.59 0.00 0.00 0.00 0.00 12:13:47 AM enp1s0 0.50 0.00 0.03 0.00 0.00 0.00 0.00 0.00 Average: tps rtps wtps dtps bread/s bwrtn/s bdscd/s Average: 4.50 0.00 4.50 0.00 0.00 22.40 0.00 Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil Average: lo 10.00 10.00 0.58 0.58 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 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _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 0.31 0.01 0.00 0.00 0.22 31.64 10.40 0.08 0.00 0.00 6.35 7.96 0.14 1.36 0.00 0.00 0.03 10160.94 0.00 0.00 0.07 6.11 dm-1 0.01 0.00 0.00 0.00 0.07 21.26 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.24 0.01 0.09 27.71 0.27 42.90 6.74 0.08 3.69 35.36 9.28 11.93 0.15 1.38 0.00 0.00 0.03 9656.21 3.18 17.19 0.12 6.11 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 7.50 0.03 0.00 0.00 8.00 3.47 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.06 6.60 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 5.00 0.02 2.50 33.33 12.00 4.80 0.00 0.00 0.00 0.00 0.00 0.00 2.50 23.60 0.12 6.60 ..... ..... # display all CPU utilization per 2 seconds 3 times root@dlp:~# mpstat -P ALL 2 3 Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:15:15 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 12:15:17 AM all 0.25 0.00 0.00 2.00 0.00 0.00 0.00 0.00 0.00 97.75 12:15:17 AM 0 0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 99.50 12:15:17 AM 1 0.00 0.00 0.00 4.02 0.00 0.00 0.00 0.00 0.00 95.98 12:15:17 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 12:15:19 AM all 0.00 0.00 0.25 2.02 0.00 0.00 0.00 0.00 0.00 97.73 12:15:19 AM 0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 12:15:19 AM 1 0.00 0.00 0.50 4.02 0.00 0.00 0.00 0.00 0.00 95.48 12:15:19 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 12:15:21 AM all 0.00 0.00 0.50 3.50 0.00 0.00 0.00 0.00 0.00 96.00 12:15:21 AM 0 0.00 0.00 0.50 1.49 0.00 0.00 0.00 0.00 0.00 98.01 12:15:21 AM 1 0.00 0.00 0.50 5.53 0.00 0.00 0.00 0.00 0.00 93.97 Average: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle Average: all 0.08 0.00 0.25 2.51 0.00 0.00 0.00 0.00 0.00 97.16 Average: 0 0.17 0.00 0.17 0.50 0.00 0.00 0.00 0.00 0.00 99.17 Average: 1 0.00 0.00 0.34 4.52 0.00 0.00 0.00 0.00 0.00 95.14 # display memory utilization of specific process per a second 3 times root@dlp:~# pidstat -r -p 21090 1 3 Linux 5.10.0-8-amd64 (dlp.srv.world) 09/16/2021 _x86_64_ (2 CPU) 12:16:34 AM UID PID minflt/s majflt/s VSZ RSS %MEM Command 12:16:35 AM 33 21090 0.00 0.00 218328 15192 0.38 apache2 12:16:36 AM 33 21090 0.00 0.00 218328 15192 0.38 apache2 12:16:37 AM 33 21090 0.00 0.00 218328 15192 0.38 apache2 Average: 33 21090 0.00 0.00 218328 15192 0.38 apache2 # 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 ..... ..... |
Sponsored Link |