SysStat : How to use2023/07/12 |
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 statistics reports. |
# CPU root@dlp:~# sar -u Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 09:28:00 PM LINUX RESTART (2 CPU) 09:30:00 PM CPU %user %nice %system %iowait %steal %idle 09:35:00 PM all 0.34 0.00 0.19 0.34 0.00 99.13 09:40:00 PM all 0.31 0.00 0.23 0.32 0.00 99.14 09:45:00 PM all 0.43 0.00 0.23 0.32 0.00 99.02 ..... ..... # memory root@dlp:~# sar -r Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 09:28:00 PM LINUX RESTART (2 CPU) 09:30:00 PM kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 09:35:00 PM 2888360 3200300 536340 13.38 19808 495524 1759676 35.12 239852 733952 136 09:40:00 PM 2873340 3186936 549704 13.72 20772 496156 1759712 35.12 241972 751416 172 09:45:00 PM 2853872 3168944 567496 14.16 21728 496676 1768928 35.30 283272 716660 0 ..... ..... # I/O root@dlp:~# sar -b Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 09:28:00 PM LINUX RESTART (2 CPU) 09:30:00 PM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 09:35:00 PM 4.81 0.06 4.75 0.00 5.31 30.18 0.00 09:40:00 PM 4.85 0.01 4.84 0.00 0.24 34.15 0.00 09:45:00 PM 4.39 0.01 4.39 0.00 0.64 30.98 0.00 ..... ..... # network root@dlp:~# sar -n DEV Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 09:28:00 PM LINUX RESTART (2 CPU) 09:30:00 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 09:35:00 PM lo 11.97 11.97 3.57 3.57 0.00 0.00 0.00 0.00 09:35:00 PM enp1s0 2.02 2.29 1.18 0.17 0.00 0.00 0.00 0.00 09:40:00 PM lo 12.03 12.03 3.54 3.54 0.00 0.00 0.00 0.00 09:40:00 PM enp1s0 2.02 2.29 1.16 0.18 0.00 0.00 0.00 0.00 09:45:00 PM lo 12.44 12.44 3.59 3.59 0.00 0.00 0.00 0.00 09:45:00 PM enp1s0 2.16 2.44 1.24 0.19 0.00 0.00 0.00 0.00 09:50:00 PM lo 12.01 12.01 3.53 3.53 0.00 0.00 0.00 0.00 ..... ..... # load avarage root@dlp:~# sar -q Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 09:28:00 PM LINUX RESTART (2 CPU) 09:30:00 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 09:35:00 PM 0 245 0.12 0.03 0.01 0 09:40:00 PM 0 245 0.00 0.00 0.00 0 09:45:00 PM 0 245 0.04 0.01 0.00 1 ..... ..... |
[2] | Display past statistics with specifying a log file. Log files are stored under the [/var/log/sa] directory by default. |
# display all statistics by a log file root@dlp:~# sar -A -f /var/log/sysstat/sa11 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 09:28:00 PM LINUX RESTART (2 CPU) 09:30:00 PM CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle 09:35:00 PM all 0.34 0.00 0.19 0.34 0.00 0.00 0.01 0.00 0.00 99.13 09:35:00 PM 0 0.36 0.00 0.18 0.22 0.00 0.00 0.01 0.00 0.00 99.23 09:35:00 PM 1 0.31 0.00 0.19 0.45 0.00 0.00 0.01 0.00 0.00 99.04 ..... ..... 10:15:01 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:20:01 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:25:01 PM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:30:01 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 22:30:00 -f /var/log/sysstat/sa11 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 10:00:01 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 10:05:01 PM 0 244 0.00 0.02 0.00 0 10:10:01 PM 0 246 0.00 0.01 0.00 0 10:15:01 PM 0 247 0.07 0.04 0.01 1 10:20:01 PM 0 246 0.00 0.02 0.00 0 10:25:01 PM 0 246 0.08 0.02 0.01 0 Average: 0 246 0.03 0.02 0.00 0 |
[3] | Display current statistics. |
# display CPU utilization per a second 3 times root@dlp:~# sar -u 1 3 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 10:37:32 PM CPU %user %nice %system %iowait %steal %idle 10:37:33 PM all 0.00 0.00 0.50 0.50 0.00 99.00 10:37:34 PM all 0.50 0.00 0.00 0.00 0.00 99.50 10:37:35 PM all 0.00 0.00 0.50 1.00 0.00 98.51 Average: all 0.17 0.00 0.33 0.50 0.00 99.00 # display I/O and network per 2 seconds 5 times root@dlp:~# sar -b -n DEV 2 5 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 10:37:51 PM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 10:37:53 PM 3.00 0.00 3.00 0.00 0.00 21.50 0.00 10:37:51 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 10:37:53 PM lo 11.50 11.50 5.02 5.02 0.00 0.00 0.00 0.00 10:37:53 PM enp1s0 1.50 2.00 0.16 0.13 0.00 0.00 0.00 0.00 10:37:53 PM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 10:37:55 PM 8.00 0.00 8.00 0.00 0.00 73.00 0.00 10:37:53 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 10:37:55 PM lo 1.00 1.00 0.08 0.08 0.00 0.00 0.00 0.00 10:37:55 PM enp1s0 0.50 1.00 0.03 0.04 0.00 0.00 0.00 0.00 ..... ..... 10:37:59 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 10:38:01 PM lo 19.50 19.50 8.89 8.89 0.00 0.00 0.00 0.00 10:38:01 PM enp1s0 1.50 2.00 0.16 0.13 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 31.30 0.00 Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil Average: lo 13.70 13.70 4.10 4.10 0.00 0.00 0.00 0.00 Average: enp1s0 1.10 1.50 0.10 0.09 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 statistics with them like follows. |
# display I/O with Mega bytes per 2 seconds root@dlp:~# iostat -mx -d 2 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _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 3.36 0.12 0.00 0.00 0.06 35.79 7.85 0.08 0.00 0.00 0.95 10.99 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 1.30 dm-1 0.02 0.00 0.00 0.00 0.04 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 2.94 0.12 0.52 15.12 0.06 41.70 5.00 0.08 2.89 36.66 1.60 17.24 0.00 0.00 0.00 0.00 0.00 0.00 2.28 2.87 0.01 1.30 ..... ..... # display all CPU utilization per 2 seconds 3 times root@dlp:~# mpstat -P ALL 2 3 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 10:39:37 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 10:39:39 PM all 0.00 0.00 0.00 0.25 0.00 0.00 0.00 0.00 0.00 99.75 10:39:39 PM 0 0.00 0.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 99.50 10:39:39 PM 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00 10:39:39 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 10:39:41 PM all 0.00 0.00 0.50 0.50 0.00 0.00 0.00 0.00 0.00 99.00 10:39:41 PM 0 0.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 99.50 10:39:41 PM 1 0.00 0.00 0.50 1.00 0.00 0.00 0.00 0.00 0.00 98.51 10:39:41 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 10:39:43 PM all 0.00 0.00 0.00 0.25 0.00 0.00 0.00 0.00 0.00 99.75 10:39:43 PM 0 0.00 0.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 99.50 10:39:43 PM 1 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.17 0.33 0.00 0.00 0.00 0.00 0.00 99.50 Average: 0 0.00 0.00 0.17 0.33 0.00 0.00 0.00 0.00 0.00 99.50 Average: 1 0.00 0.00 0.17 0.33 0.00 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 494 1 3 Linux 6.1.0-9-amd64 (dlp.srv.world) 07/11/2023 _x86_64_ (2 CPU) 10:40:50 PM UID PID minflt/s majflt/s VSZ RSS %MEM Command 10:40:51 PM 106 494 0.00 0.00 1613312 84148 2.10 prometheus 10:40:52 PM 106 494 0.00 0.00 1613312 84148 2.10 prometheus 10:40:53 PM 106 494 3.00 0.00 1613312 84148 2.10 prometheus Average: 106 494 1.00 0.00 1613312 84148 2.10 prometheus # display CIFS statistics 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 |
|