diff --git a/Linux/command/sar.md b/Linux/command/sar.md index bcee24f3..d638f5fe 100644 --- a/Linux/command/sar.md +++ b/Linux/command/sar.md @@ -64,5 +64,92 @@ kbmemfree与kbmemused字段分别显示内存的未使用与已使用空间, ```shell sar -o temp 60 10 ``` +**查看CPU负载** +``` +(pytorch) ykl@ykl-OptiPlex-3070:~$ sar -u 1 5 +Linux 5.4.0-92-generic (ykl-OptiPlex-3070) 2021年12月24日 _x86_64_ (6 CPU) +16时12分46秒 CPU %user %nice %system %iowait %steal %idle +16时12分47秒 all 0.50 0.00 1.01 6.04 0.00 92.45 +16时12分48秒 all 0.83 0.00 0.83 3.17 0.00 95.16 +16时12分49秒 all 0.67 0.00 1.34 0.00 0.00 97.99 +16时12分50秒 all 0.50 0.00 0.34 0.00 0.00 99.16 +16时12分51秒 all 1.00 0.00 1.67 0.00 0.00 97.33 +平均时间: all 0.70 0.00 1.04 1.84 0.00 96.42 +``` +**查看磁盘IO读写** +``` +[root@mysql ~]# sar -b 1 5 +Linux 3.10.0-957.el7.x86_64 (mysql) 01/27/2019 _x86_64_ (2 CPU) +03:10:20 AM tps rtps wtps bread/s bwrtn/s +03:10:21 AM 0.00 0.00 0.00 0.00 0.00 +03:10:22 AM 0.00 0.00 0.00 0.00 0.00 +03:10:23 AM 0.00 0.00 0.00 0.00 0.00 +03:10:24 AM 1.02 0.00 1.02 0.00 57.14 +03:10:25 AM 3.06 0.00 3.06 0.00 73.47 +Average: 0.81 0.00 0.81 0.00 26.07 +``` +**查看网卡流量** +``` +(pytorch) ykl@ykl-OptiPlex-3070:~$ sar -n DEV 1 5 +Linux 5.4.0-92-generic (ykl-OptiPlex-3070) 2021年12月24日 _x86_64_ (6 CPU) + +16时03分10秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +16时03分11秒 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +16时03分11秒 enp2s0 1149.00 575.00 1674.14 46.28 0.00 0.00 0.00 1.37 +16时03分11秒 lo 33.00 33.00 10.96 10.96 0.00 0.00 0.00 0.00 + +16时03分11秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +16时03分12秒 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +16时03分12秒 enp2s0 1075.00 521.00 1585.25 34.16 0.00 0.00 0.00 1.30 +16时03分12秒 lo 13.00 13.00 1.17 1.17 0.00 0.00 0.00 0.00 + +16时03分12秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +16时03分13秒 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +16时03分13秒 enp2s0 1068.00 518.00 1572.01 33.78 0.00 0.00 0.00 1.29 +16时03分13秒 lo 6.00 6.00 0.47 0.47 0.00 0.00 0.00 0.00 + +16时03分13秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +16时03分14秒 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +16时03分14秒 enp2s0 1109.00 550.00 1636.83 35.83 0.00 0.00 0.00 1.34 +16时03分14秒 lo 4.00 4.00 0.33 0.33 0.00 0.00 0.00 0.00 + +16时03分14秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +16时03分15秒 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +16时03分15秒 enp2s0 1160.00 559.00 1708.29 36.30 0.00 0.00 0.00 1.40 +16时03分15秒 lo 5.00 5.00 0.40 0.40 0.00 0.00 0.00 0.00 + +平均时间: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil +平均时间: docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 +平均时间: enp2s0 1112.20 544.60 1635.31 37.27 0.00 0.00 0.00 1.34 +平均时间: lo 12.20 12.20 2.66 2.66 0.00 0.00 0.00 0.00 +``` + +``` +# IFACE 具体的网卡名称 +# rxpck/s 每秒接收的数据包的数量 +# txpck/s 每秒发送的数据包的数量 +# rxkB/s 每秒接收的字节数大小 +# txkB/s 每秒发送的字节数大小 +# rxcmp/s 每秒接收的压缩数据包的数量 +# txcmp/s 每秒发送的压缩数据包的数量 +# rxmcst/s 每秒接收的多播数据包的数量 +``` + +**查看内存交换空间使用** +``` +(pytorch) ykl@ykl-OptiPlex-3070:~$ sar -r 1 5 +Linux 5.4.0-92-generic (ykl-OptiPlex-3070) 2021年12月24日 _x86_64_ (6 CPU) + +16时25分49秒 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +16时25分50秒 135216 5066392 2471828 31.04 2226212 2435212 7844496 77.98 2478992 4515428 35880 +16时25分51秒 134520 5066080 2472144 31.05 2226220 2435204 7847576 78.01 2478844 4515428 35880 +16时25分52秒 134772 5066396 2471824 31.04 2226220 2435212 7847576 78.01 2478652 4515436 35888 +16时25分53秒 134852 5066476 2471744 31.04 2226220 2435212 7847576 78.01 2478624 4515436 35888 +16时25分54秒 134916 5066540 2471680 31.04 2226220 2435212 7847576 78.01 2478752 4515436 35888 +平均时间: 134855 5066377 2471844 31.05 2226218 2435210 7846960 78.01 2478773 4515433 35885 +(pytorch) ykl@ykl-OptiPlex-3070:~$ +``` + +> [参考文档](https://www.cnblogs.com/mingerlcm/p/10332360.html)