SysStat : How to use2023/03/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)
|
|||||||||||||||||||
[1] | Display today's statics reports. |
# CPU [root@dlp ~]# sar -u Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 12:43:24 AM LINUX RESTART (2 CPU) 12:50:00 AM CPU %user %nice %system %iowait %steal %idle 12:55:00 AM all 0.01 0.00 0.08 0.01 0.00 99.91 01:00:00 AM all 1.77 0.03 0.66 0.18 0.00 97.37 01:05:00 AM all 0.75 0.13 1.01 0.02 0.00 98.09 01:10:00 AM all 0.60 0.00 0.51 0.00 0.00 98.89 Average: all 1.19 0.06 0.94 0.41 0.00 97.40 # memory [root@dlp ~]# sar -r Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 12:43:24 AM LINUX RESTART (2 CPU) 12:50:00 AM kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 12:55:00 AM 3295804 3384344 157036 4.12 2708 283256 249932 3.59 183276 168552 0 01:00:00 AM 3038116 3358392 166312 4.36 2708 511560 246760 3.55 215248 362224 68 01:05:00 AM 2977064 3306920 217644 5.71 2708 519776 552036 7.93 225396 398832 12 01:10:00 AM 2999168 3328584 199532 5.23 2708 519936 551544 7.93 232044 391780 0 Average: 2960562 3327043 197987 5.19 2708 556081 467543 6.72 228339 423943 29 # I/O [root@dlp ~]# sar -b Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 12:43:24 AM LINUX RESTART (2 CPU) 12:50:00 AM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 12:55:00 AM 0.52 0.28 0.24 0.00 28.03 3.91 0.00 01:00:00 AM 12.50 1.76 10.74 0.00 57.66 1952.86 0.00 01:05:00 AM 3.36 0.26 3.10 0.00 20.56 372.92 0.00 01:10:00 AM 0.45 0.01 0.43 0.00 0.77 7.07 0.00 Average: 7.83 0.45 7.37 0.00 21.09 887.30 0.00 # network [root@dlp ~]# sar -n DEV Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 12:43:24 AM LINUX RESTART (2 CPU) 12:50:00 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 12:55:00 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12:55:00 AM enp1s0 0.68 0.05 0.05 0.00 0.00 0.00 0.00 0.00 01:00:00 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:00:00 AM enp1s0 23.41 17.70 155.44 1.25 0.00 0.00 0.00 0.00 01:05:00 AM lo 0.99 0.99 0.06 0.06 0.00 0.00 0.00 0.00 01:05:00 AM enp1s0 5.30 4.18 2.59 8.62 0.00 0.00 0.00 0.00 01:10:00 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:10:00 AM enp1s0 2.10 1.19 0.68 1.66 0.00 0.00 0.00 0.00 01:15:00 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:15:00 AM enp1s0 2.58 1.63 14.15 0.11 0.00 0.00 0.00 0.00 Average: lo 0.12 0.12 0.01 0.01 0.00 0.00 0.00 0.00 Average: enp1s0 10.95 6.98 69.97 1.74 0.00 0.00 0.00 0.00 # load avarage [root@dlp ~]# sar -q Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 12:43:24 AM LINUX RESTART (2 CPU) 12:50:00 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 12:55:00 AM 0 142 0.00 0.00 0.00 0 01:00:00 AM 0 653 0.33 0.08 0.02 0 01:05:00 AM 0 423 0.00 0.03 0.00 0 01:10:00 AM 0 169 0.00 0.00 0.00 0 Average: 0 312 0.17 0.08 0.03 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/sa22 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 12:43:24 AM LINUX RESTART (2 CPU) 12:50:00 AM CPU %usr %nice %sys %iowait %steal %irq %soft %guest %gnice %idle 12:55:00 AM all 0.01 0.00 0.02 0.01 0.00 0.05 0.00 0.00 0.00 99.91 12:55:00 AM 0 0.01 0.00 0.03 0.01 0.00 0.10 0.00 0.00 0.00 99.85 12:55:00 AM 1 0.01 0.00 0.02 0.00 0.00 0.01 0.00 0.00 0.00 99.96 01:00:00 AM all 1.77 0.03 0.45 0.18 0.00 0.16 0.04 0.00 0.00 97.37 ..... ..... 01:25:00 AM 0 46.89 0.00 0.00 0.00 0.00 01:25:00 AM 1 0.00 0.00 0.00 0.00 0.00 01:30:00 AM all 0.74 0.00 0.00 0.00 0.00 01:30:00 AM 0 0.74 0.00 0.00 0.00 0.00 01:30:00 AM 1 0.00 0.00 0.00 0.00 0.00 Average: all 11.06 0.00 0.00 0.00 0.00 Average: 0 11.06 0.00 0.00 0.00 0.00 # display the load average with specifying times by a log file [root@dlp ~]# sar -q -s 01:00:00 -e 01:30:00 -f /var/log/sa/sa22 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 01:00:00 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 01:05:00 AM 0 423 0.00 0.03 0.00 0 01:10:00 AM 0 169 0.00 0.00 0.00 0 01:15:00 AM 1 169 0.02 0.01 0.00 0 01:20:00 AM 0 335 0.00 0.03 0.00 0 01:25:00 AM 0 431 0.98 0.36 0.12 0 01:30:00 AM 0 172 0.00 0.12 0.08 0 Average: 0 283 0.17 0.09 0.03 0 |
[3] | Display current statics. |
# display CPU utilization per a second 3 times [root@dlp ~]# sar -u 1 3 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 01:34:38 AM CPU %user %nice %system %iowait %steal %idle 01:34:39 AM all 0.50 0.00 0.50 0.00 0.00 99.00 01:34:40 AM all 0.50 0.00 1.49 0.00 0.00 98.02 01:34:41 AM all 0.00 0.00 0.00 0.00 0.00 100.00 Average: all 0.33 0.00 0.67 0.00 0.00 99.00 # display I/O and network per 2 seconds 5 times [root@dlp ~]# sar -b -n DEV 2 5 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 01:34:55 AM tps rtps wtps dtps bread/s bwrtn/s bdscd/s 01:34:57 AM 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:34:55 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 01:34:57 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:34:57 AM enp1s0 0.50 0.00 0.03 0.00 0.00 0.00 0.00 0.00 ..... ..... 01:35:03 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 01:35:05 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:35:05 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: 0.50 0.00 0.50 0.00 0.00 4.30 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.90 0.00 0.11 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.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _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 2.76 0.07 0.00 0.00 0.10 25.97 8.24 0.34 0.00 0.00 5.50 41.71 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.05 2.19 dm-1 0.03 0.00 0.00 0.00 0.13 23.72 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 sr0 0.00 0.00 0.00 0.00 0.00 0.17 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.93 0.09 0.00 0.11 0.11 30.10 5.82 0.33 2.57 30.62 5.46 58.50 0.00 0.00 0.00 0.00 0.00 0.00 1.70 12.90 0.05 2.20 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 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 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 sr0 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 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 ..... ..... # display all CPU utilization per 2 seconds 3 times [root@dlp ~]# mpstat -P ALL 2 3 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 01:36:31 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 01:36:33 AM all 28.75 0.00 21.50 0.00 0.25 0.00 0.00 0.00 0.00 49.50 01:36:33 AM 0 0.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 99.00 01:36:33 AM 1 57.00 0.00 42.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 01:36:33 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 01:36:35 AM all 29.25 0.00 21.50 0.00 0.50 0.00 0.00 0.00 0.00 48.75 01:36:35 AM 0 0.50 0.00 1.00 0.00 1.00 0.00 0.00 0.00 0.00 97.50 01:36:35 AM 1 58.00 0.00 42.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 01:36:35 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 01:36:37 AM all 29.25 0.00 21.25 0.00 0.75 0.25 0.00 0.00 0.00 48.50 01:36:37 AM 0 0.50 0.00 1.00 0.00 1.00 0.50 0.00 0.00 0.00 97.00 01:36:37 AM 1 58.00 0.00 41.50 0.00 0.50 0.00 0.00 0.00 0.00 0.00 Average: CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle Average: all 29.08 0.00 21.42 0.00 0.50 0.08 0.00 0.00 0.00 48.92 Average: 0 0.50 0.00 0.83 0.00 0.67 0.17 0.00 0.00 0.00 97.83 Average: 1 57.67 0.00 42.00 0.00 0.33 0.00 0.00 0.00 0.00 0.00 # display memory utilization of specific process per a second 3 times [root@dlp ~]# pidstat -r -p 3028 1 3 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _x86_64_ (2 CPU) 01:38:47 AM UID PID minflt/s majflt/s VSZ RSS %MEM Command 01:38:48 AM 982 3028 0.00 0.00 268912 51824 1.36 netdata 01:38:49 AM 982 3028 0.00 0.00 268912 51824 1.36 netdata 01:38:50 AM 982 3028 0.00 0.00 268912 51824 1.36 netdata Average: 982 3028 0.00 0.00 268912 51824 1.36 netdata # display CIFS statics with Mega bytes per a 1 second 3 times [root@dlp ~]# cifsiostat -m 1 3 Linux 5.14.0-70.el9.x86_64 (dlp.srv.world) 03/22/2022 _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 |
Sponsored Link |