Linux命令(141)之sar
  wwLZeziuqjLR 2023年12月06日 21 0

linux命令之sar

1.sar介绍

linux命令sar是用来从各个方面对系统的活动进行监控报告,包括:CPU使用率,内存使用,磁盘I/O等

2.sar用法

sar [参数] [ <时间间隔> [ <次数> ] ]

sar参数

参数

说明

-A

显示系统所有资源设备(CPU/内存/磁盘)的运行情况

-u

显示系统所有CPU在采样时间内的负载情况

-d

显示系统所有硬盘在采样时间内的使用情况

-r

显示系统内存在采样时间内的使用情况

-b

显示缓存区在采样时间内的使用情况

-v

显示内核表的统计信息

-q

显示运行列表中的进程数、进程大小、系统平均负载等

-B

显示内存分页监控的使用情况

-w

显示系统交换活动在采样时间内的状态

-n

显示网络运行状态,E.g:DEV(显示网络接口信息)/EDEV(显示网络错误的统计数据)/SOCK(显示套接字信息)/FULL(等价于DEV/EDEV/SOCK)

3.实例

3.1.显示系统所有资源设备的运行情况

命令:

sar -A

[root@centos79 ~]# sar -A
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

08时53分14秒       LINUX RESTART

09时00分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
09时10分01秒     all      1.93      0.00      0.40      0.03      0.00      0.00      0.04      0.00      0.00     97.60
09时10分01秒       0      1.94      0.00      0.38      0.03      0.00      0.00      0.04      0.00      0.00     97.61
09时10分01秒       1      1.92      0.00      0.41      0.04      0.00      0.00      0.04      0.00      0.00     97.59

09时10分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
09时20分01秒     all      1.17      0.01      0.56      0.11      0.00      0.00      0.04      0.00      0.00     98.12
09时20分01秒       0      1.24      0.00      0.45      0.10      0.00      0.00      0.04      0.00      0.00     98.16
09时20分01秒       1      1.10      0.02      0.67      0.11      0.00      0.00      0.04      0.00      0.00     98.07

09时20分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
09时30分01秒     all      1.17      0.00      0.31      0.01      0.00      0.00      0.04      0.00      0.00     98.47
09时30分01秒       0      1.17      0.00      0.30      0.02      0.00      0.00      0.04      0.00      0.00     98.47
09时30分01秒       1      1.17      0.00      0.32      0.01      0.00      0.00      0.04      0.00      0.00     98.47

09时30分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
09时40分01秒     all      0.90      0.00      0.28      0.01      0.00      0.00      0.04      0.00      0.00     98.77
09时40分01秒       0      0.85      0.00      0.27      0.02      0.00      0.00      0.04      0.00      0.00     98.81
09时40分01秒       1      0.95      0.00      0.29      0.00      0.00      0.00      0.04      0.00      0.00     98.72

09时40分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
09时50分02秒     all      0.93      0.00      0.29      0.04      0.00      0.00      0.04      0.00      0.00     98.70
09时50分02秒       0      0.91      0.00      0.28      0.04      0.00      0.00      0.04      0.00      0.00     98.73
09时50分02秒       1      0.95      0.00      0.30      0.04      0.00      0.00      0.04      0.00      0.00     98.68

09时50分02秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
10时00分01秒     all      0.67      0.00      0.23      0.00      0.00      0.00      0.04      0.00      0.00     99.06
10时00分01秒       0      0.66      0.00      0.23      0.00      0.00      0.00      0.04      0.00      0.00     99.08
10时00分01秒       1      0.68      0.00      0.24      0.01      0.00      0.00      0.04      0.00      0.00     99.04

10时00分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
10时10分01秒     all      0.65      0.00      0.22      0.01      0.00      0.00      0.04      0.00      0.00     99.09
10时10分01秒       0      0.63      0.00      0.21      0.01      0.00      0.00      0.04      0.00      0.00     99.12
10时10分01秒       1      0.67      0.00      0.23      0.00      0.00      0.00      0.04      0.00      0.00     99.07

10时10分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
10时20分01秒     all      0.57      0.00      0.20      0.00      0.00      0.00      0.04      0.00      0.00     99.20
10时20分01秒       0      0.55      0.00      0.20      0.00      0.00      0.00      0.04      0.00      0.00     99.21
10时20分01秒       1      0.58      0.00      0.20      0.00      0.00      0.00      0.04      0.00      0.00     99.18

10时20分01秒     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
10时30分01秒     all      0.59      0.00      0.22      0.01      0.00      0.00      0.04      0.00      0.00     99.15
10时30分01秒       0      0.63      0.00      0.21      0.00      0.00      0.00      0.04      0.00      0.00     99.12
10时30分01秒       1      0.55      0.00      0.22      0.01      0.00      0.00      0.04      0.00      0.00     99.18

平均时间:     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
平均时间:     all      0.95      0.00      0.30      0.02      0.00      0.00      0.04      0.00      0.00     98.69
平均时间:       0      0.95      0.00      0.28      0.02      0.00      0.00      0.04      0.00      0.00     98.70
平均时间:       1      0.95      0.00      0.32      0.02      0.00      0.00      0.04      0.00      0.00     98.67

09时00分01秒    proc/s   cswch/s
09时10分01秒      0.22    857.15
09时20分01秒      0.25    876.92
09时30分01秒      0.17    786.82
09时40分01秒      0.30    806.04
09时50分02秒      0.27    801.23
10时00分01秒      0.19    789.30
10时10分01秒      0.23    757.36
10时20分01秒      0.20    789.10
10时30分01秒      0.18    757.96
平均时间:      0.22    802.44

09时00分01秒  pswpin/s pswpout/s
09时10分01秒      0.00      0.00
09时20分01秒      0.00      0.00
09时30分01秒      0.00      0.00
09时40分01秒      0.00      0.00
09时50分02秒      0.00      0.00
10时00分01秒      0.00      0.00
10时10分01秒      0.00      0.00
10时20分01秒      0.00      0.00
10时30分01秒      0.00      0.00
平均时间:      0.00      0.00

09时00分01秒  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
09时10分01秒      0.81     14.65    230.48      0.01    199.35      0.00      0.00      0.00      0.00
09时20分01秒    198.86     39.04    203.33      0.08    157.73      0.00      0.00      0.00      0.00
09时30分01秒      0.03     11.74    174.47      0.00    145.38      0.00      0.00      0.00      0.00
09时40分01秒      0.08     12.57    231.92      0.00    183.07      0.00      0.00      0.00      0.00
09时50分02秒      2.39     12.86    216.33      0.01    199.36      0.00      0.00      0.00      0.00
10时00分01秒      0.00     11.42    199.12      0.00    137.01      0.00      0.00      0.00      0.00
10时10分01秒      0.00     12.37    187.29      0.00    151.01      0.00      0.00      0.00      0.00
10时20分01秒      0.00     11.02    178.99      0.00    145.38      0.00      0.00      0.00      0.00
10时30分01秒      0.00     11.61    163.72      0.00    154.64      0.00      0.00      0.00      0.00
平均时间:     22.46     15.25    198.41      0.01    163.67      0.00      0.00      0.00      0.00

09时00分01秒       tps      rtps      wtps   bread/s   bwrtn/s
09时10分01秒      1.57      0.05      1.51      1.61     29.29
09时20分01秒     15.20     13.37      1.82    397.71     78.09
09时30分01秒      1.27      0.00      1.27      0.07     23.48
09时40分01秒      1.40      0.00      1.39      0.16     25.14
09时50分02秒      1.46      0.08      1.38      4.78     25.71
10时00分01秒      1.27      0.00      1.27      0.00     22.84
10时10分01秒      1.42      0.00      1.42      0.00     24.74
10时20分01秒      1.25      0.00      1.25      0.00     22.04
10时30分01秒      1.36      0.00      1.36      0.00     23.21
平均时间:      2.91      1.50      1.41     44.93     30.51

09时00分01秒   frmpg/s   bufpg/s   campg/s
09时10分01秒    -15.75      0.00      0.25
09时20分01秒    -98.15      0.00      6.47
09时30分01秒    -15.29      0.00      0.07
09时40分01秒     -8.90      0.00      0.02
09时50分02秒     -3.72      0.00      0.58
10时00分01秒    -34.01      0.00     -0.01
10时10分01秒      0.68      0.00      0.07
10时20分01秒     -2.49      0.00      0.01
10时30分01秒     -3.27      0.00     -0.03
平均时间:    -20.10      0.00      0.83

09时00分01秒 kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
09时10分01秒   2193324   8025772     78.54      1080   1066964  11986316     89.69   6641260    883652        56
09时20分01秒   1957704   8261392     80.84      1080   1082500  12053884     90.19   6683008    896224       128
09时30分01秒   1920992   8298104     81.20      1080   1082664  12062324     90.25   6716808    896252        60
09时40分01秒   1899628   8319468     81.41      1080   1082712  12098428     90.52   6740188    894260       116
09时50分02秒   1890700   8328396     81.50      1080   1084112  12077592     90.37   6747184    894980        56
10时00分01秒   1809184   8409912     82.30      1080   1084088  12082460     90.40   6831776    894976       140
10时10分01秒   1810824   8408272     82.28      1080   1084260  12025084     89.98   6830056    895004        52
10时20分01秒   1804836   8414260     82.34      1080   1084296  12084976     90.42   6837172    894112        56
10时30分01秒   1796996   8422100     82.42      1080   1084212  12087600     90.44   6840192    894100        32
平均时间:   1898243   8320853     81.42      1080   1081756  12062074     90.25   6763072    893729        77

09时00分01秒 kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
09时10分01秒   3145724         0      0.00         0      0.00
09时20分01秒   3145724         0      0.00         0      0.00
09时30分01秒   3145724         0      0.00         0      0.00
09时40分01秒   3145724         0      0.00         0      0.00
09时50分02秒   3145724         0      0.00         0      0.00
10时00分01秒   3145724         0      0.00         0      0.00
10时10分01秒   3145724         0      0.00         0      0.00
10时20分01秒   3145724         0      0.00         0      0.00
10时30分01秒   3145724         0      0.00         0      0.00
平均时间:   3145724         0      0.00         0      0.00

09时00分01秒 kbhugfree kbhugused  %hugused
09时10分01秒         0         0      0.00
09时20分01秒         0         0      0.00
09时30分01秒         0         0      0.00
09时40分01秒         0         0      0.00
09时50分02秒         0         0      0.00
10时00分01秒         0         0      0.00
10时10分01秒         0         0      0.00
10时20分01秒         0         0      0.00
10时30分01秒         0         0      0.00
平均时间:         0         0      0.00

09时00分01秒 dentunusd   file-nr  inode-nr    pty-nr
09时10分01秒    138396      6784     83531         5
09时20分01秒    195455      6752    139763         5
09时30分01秒    196056      6752    139779         5
09时40分01秒    197136      6912    139973         6
09时50分02秒    197936      6848    139955         6
10时00分01秒    198701      6816    139961         6
10时10分01秒    199354      6880    139994         6
10时20分01秒    200093      6816    139989         6
10时30分01秒    200740      6816    139941         6
平均时间:    191541      6820    133654         6

09时00分01秒   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
09时10分01秒         1       694      0.07      0.24      0.49         0
09时20分01秒         1       692      0.11      0.35      0.42         0
09时30分01秒         4       692      0.00      0.06      0.24         0
09时40分01秒        10       697      0.04      0.06      0.15         0
09时50分02秒         7       693      0.11      0.10      0.13         0
10时00分01秒         1       694      0.07      0.06      0.11         0
10时10分01秒         3       694      0.01      0.07      0.10         0
10时20分01秒         1       694      0.10      0.06      0.06         0
10时30分01秒         8       694      0.02      0.04      0.05         0
平均时间:         4       694      0.06      0.12      0.19         0

09时00分01秒       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
09时10分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时10分01秒    dev8-0      1.57      1.61     29.29     19.74      0.01      3.90      3.07      0.48
09时10分01秒  dev253-0      1.71      1.61     29.29     18.08      0.01      3.71      2.81      0.48
09时10分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时10分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒    dev8-0     15.20    397.71     78.09     31.31      0.28     18.43     17.78     27.02
09时20分01秒  dev253-0     15.39    397.03     78.09     30.86      0.28     18.28     17.54     27.01
09时20分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒  dev253-2      0.02      0.47      0.00     25.45      0.00     28.27     28.27      0.05
09时30分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒    dev8-0      1.27      0.07     23.48     18.54      0.00      2.65      2.02      0.26
09时30分01秒  dev253-0      1.37      0.07     23.48     17.17      0.00      2.54      1.87      0.26
09时30分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒    dev8-0      1.40      0.16     25.14     18.09      0.00      2.80      2.25      0.31
09时40分01秒  dev253-0      1.52      0.16     25.14     16.63      0.00      2.66      2.07      0.31
09时40分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

09时40分01秒       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
09时50分02秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒    dev8-0      1.46      4.78     25.71     20.94      0.00      2.72      2.22      0.32
09时50分02秒  dev253-0      1.58      4.78     25.71     19.24      0.00      2.56      2.04      0.32
09时50分02秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒    dev8-0      1.27      0.00     22.84     18.00      0.00      2.54      2.15      0.27
10时00分01秒  dev253-0      1.38      0.00     22.84     16.52      0.00      2.38      1.97      0.27
10时00分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒    dev8-0      1.42      0.00     24.74     17.39      0.00      2.39      2.00      0.28
10时10分01秒  dev253-0      1.53      0.00     24.74     16.19      0.00      2.30      1.86      0.28
10时10分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒    dev8-0      1.25      0.00     22.04     17.68      0.00      2.28      1.90      0.24
10时20分01秒  dev253-0      1.35      0.00     22.04     16.29      0.00      2.17      1.75      0.24
10时20分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

10时20分01秒       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
10时30分01秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒    dev8-0      1.36      0.00     23.21     17.05      0.00      2.76      2.24      0.31
10时30分01秒  dev253-0      1.46      0.00     23.21     15.94      0.00      2.65      2.10      0.31
10时30分01秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:    dev8-0      2.91     44.93     30.51     25.93      0.03     11.87     11.26      3.28
平均时间:  dev253-0      3.03     44.85     30.51     24.84      0.03     11.46     10.80      3.28
平均时间:  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:  dev253-2      0.00      0.05      0.00     25.45      0.00     28.27     28.27      0.01

09时00分01秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
09时10分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时10分01秒     ens32      0.41      0.31      0.04      0.13      0.00      0.00      0.00
09时10分01秒 vetha6a8a46      6.19      7.39      1.20      3.55      0.00      0.00      0.00
09时10分01秒 vethc265dbe      0.37      0.33      0.33      0.06      0.00      0.00      0.00
09时20分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒     ens32      0.47      0.31      0.04      0.04      0.00      0.00      0.00
09时20分01秒 vetha6a8a46      5.90      7.05      1.07      3.63      0.00      0.00      0.00
09时20分01秒 vethc265dbe      0.36      0.33      0.44      0.06      0.00      0.00      0.00
09时30分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒     ens32      0.25      0.19      0.02      0.02      0.00      0.00      0.00
09时30分01秒 vetha6a8a46      5.92      7.07      1.07      3.62      0.00      0.00      0.00
09时30分01秒 vethc265dbe      0.36      0.33      0.44      0.06      0.00      0.00      0.00
09时40分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒     ens32      1.24      0.38      0.11      0.23      0.00      0.00      0.00
09时40分01秒 vetha6a8a46      5.94      7.09      1.08      3.63      0.00      0.00      0.00
09时40分01秒 vethc265dbe      0.37      0.33      0.44      0.06      0.00      0.00      0.00
09时50分02秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒     ens32      0.97      0.62      0.08      0.14      0.00      0.00      0.00
09时50分02秒 vetha6a8a46      5.92      7.07      1.07      3.63      0.00      0.00      0.00
09时50分02秒 vethc265dbe      0.37      0.33      0.45      0.06      0.00      0.00      0.00
10时00分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒     ens32      0.35      0.22      0.03      0.02      0.00      0.00      0.00
10时00分01秒 vetha6a8a46      5.94      7.12      1.09      3.65      0.00      0.00      0.00
10时00分01秒 vethc265dbe      0.37      0.33      0.44      0.06      0.00      0.00      0.00
10时10分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒     ens32      0.35      0.21      0.03      0.04      0.00      0.00      0.00
10时10分01秒 vetha6a8a46      5.93      7.09      1.08      3.64      0.00      0.00      0.00
10时10分01秒 vethc265dbe      0.37      0.33      0.44      0.06      0.00      0.00      0.00
10时20分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒     ens32      0.25      0.13      0.02      0.02      0.00      0.00      0.00
10时20分01秒 vetha6a8a46      5.92      7.08      1.07      3.63      0.00      0.00      0.00
10时20分01秒 vethc265dbe      0.37      0.33      0.44      0.06      0.00      0.00      0.00

10时20分01秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
10时30分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒     ens32      0.27      0.21      0.02      0.14      0.00      0.00      0.00
10时30分01秒 vetha6a8a46      5.92      7.09      1.08      3.63      0.00      0.00      0.00
10时30分01秒 vethc265dbe      0.37      0.33      0.44      0.06      0.00      0.00      0.00
平均时间: br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:     ens32      0.51      0.29      0.04      0.09      0.00      0.00      0.00
平均时间: vetha6a8a46      5.95      7.12      1.09      3.62      0.00      0.00      0.00
平均时间: vethc265dbe      0.37      0.33      0.43      0.06      0.00      0.00      0.00

09时00分01秒     IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
09时10分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时10分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时10分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时10分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

10时20分01秒     IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
10时30分01秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒 vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间: br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间: vetha6a8a46      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间: vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

09时00分01秒    call/s retrans/s    read/s   write/s  access/s  getatt/s
09时10分01秒      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:      0.00      0.00      0.00      0.00      0.00      0.00

09时00分01秒   scall/s badcall/s  packet/s     udp/s     tcp/s     hit/s    miss/s   sread/s  swrite/s saccess/s sgetatt/s
09时10分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时20分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时30分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时40分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09时50分02秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时00分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时10分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时20分01秒      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时30分01秒      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

09时00分01秒    totsck    tcpsck    udpsck    rawsck   ip-frag    tcp-tw
09时10分01秒      3261       133         7         0         0         0
09时20分01秒      3260       133         7         0         0         0
09时30分01秒      3260       133         7         0         0         0
09时40分01秒      3270       135         7         0         0         0
09时50分02秒      3264       135         7         0         0         0
10时00分01秒      3264       135         7         0         0         0
10时10分01秒      3264       135         7         0         0         0
10时20分01秒      3264       135         7         0         0         0
10时30分01秒      3264       135         7         0         0         0
平均时间:      3263       134         7         0         0         0
[root@centos79 ~]#

3.2.监控CPU资源

命令:

sar -u 3 2 -o cpu.txt

每3秒采样一次,连续采样2次,并将采样结果以二进制形式存入当前目录下的文件cpu.txt中

[root@centos79 ~]# sar -u 3 2 -o cpu.txt
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时36分43秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
10时36分46秒     all      0.17      0.00      0.17      0.00      0.00     99.66
10时36分49秒     all      0.51      0.00      0.17      0.00      0.00     99.32
平均时间:     all      0.34      0.00      0.17      0.00      0.00     99.49
[root@centos79 ~]# ls -l cpu.txt 
-rw-r--r-- 1 root root 70808 12月  1 10:36 cpu.txt
[root@centos79 ~]#

上述文件通过以下命令进行查看

命令:

sar -u -f cpu.txt

[root@centos79 ~]# sar -u -f cpu.txt 
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时36分43秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
10时36分46秒     all      0.17      0.00      0.17      0.00      0.00     99.66
10时36分49秒     all      0.51      0.00      0.17      0.00      0.00     99.32
平均时间:     all      0.34      0.00      0.17      0.00      0.00     99.49
[root@centos79 ~]#

其中,

CPU:all表示统计信息为所有CPU的平均值

%user:显示在用户级别运行使用CPU总时间的百分比

%nice:显示在用户级别,用于 nice 操作,所占用 CPU 总时间的百分比

%system:在核心级别运行所使用 CPU 总时间的百分比

%iowait:显示用于等待 I/O 操作占用 CPU 总时间的百分比

%steal:管理程序为另一个虚拟进程提供服务而等待虚拟 CPU 的百分比

%idle:显示 CPU 空闲时间占用 CPU 总时间的百分比

3.3.监控内存和交换空间

命令:

sar -r 3 2

[root@centos79 ~]# sar -r 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时43分02秒 kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
10时43分05秒   1798928   8420168     82.40      1080   1084440  12019140     89.93   6843824    894104       124
10时43分08秒   1799168   8419928     82.39      1080   1084440  12019140     89.93   6843748    894104        52
平均时间:   1799048   8420048     82.40      1080   1084440  12019140     89.93   6843786    894104        88
[root@centos79 ~]#

kbmemfree:剩余内存总量

kbmemused:使用的内存总量,使用量=总内存-剩余内存-buffer-cache

%memused:kbmemused 和内存总量(不包括 swap)的一个百分比

kbbuffers:被内核用来作为buffer的内存量

kbcached:被内核用来作为cache的内存量

kbcommit:当前工作负载下,可以保证不出现内存不足的内存量

%commit:指kbcommit占内存/swap的百分率

kbactive:当前活跃内存量。除非万不得已,这部分内存才会被回收

kbinact:当前非活跃内存总量,当内存不足时,这部分内存最容易被内核收回

kbdirty:脏页大小,脏页指的是暂存于内存还没来得及持久化到硬盘的数据

3.4.监控内核表

命令:

sar -v 3 2

[root@centos79 ~]# sar -v 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时53分24秒 dentunusd   file-nr  inode-nr    pty-nr
10时53分27秒    202322      6784    139913         6
10时53分30秒    202322      6784    139913         6
平均时间:    202322      6784    139913         6
[root@centos79 ~]#

3.5.监控内存分页

命令:

sar -B 3 2

[root@centos79 ~]# sar -B 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时54分12秒  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
10时54分15秒      0.00      5.33    154.33      0.00    207.33      0.00      0.00      0.00      0.00
10时54分18秒      0.00      0.00    934.00      0.00    319.00      0.00      0.00      0.00      0.00
平均时间:      0.00      2.67    544.17      0.00    263.17      0.00      0.00      0.00      0.00
[root@centos79 ~]#

3.6.监控I/O及传送速率

命令:

sar -b 3 2

[root@centos79 ~]# sar -b 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时55分15秒       tps      rtps      wtps   bread/s   bwrtn/s
10时55分18秒      0.00      0.00      0.00      0.00      0.00
10时55分21秒      3.00      0.00      3.00      0.00     76.67
平均时间:      1.50      0.00      1.50      0.00     38.33
[root@centos79 ~]#

3.7.监控进程队列长度和平均负载状态

命令:

sar -q 3 2

[root@centos79 ~]# sar -q 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时56分06秒   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
10时56分09秒         0       693      0.09      0.13      0.10         0
10时56分12秒         0       693      0.08      0.13      0.10         0
平均时间:         0       693      0.09      0.13      0.10         0
[root@centos79 ~]#

3.8.监控系统交换活动在采样时间内的状态

命令:

sar -w 3 2

[root@centos79 ~]# sar -w 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时56分52秒    proc/s   cswch/s
10时56分55秒      0.00    770.67
10时56分58秒      0.00    779.67
平均时间:      0.00    775.17
[root@centos79 ~]#

3.9.监控系统交换活动信息

命令:

sar -W 3 2

[root@centos79 ~]# sar -W 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时58分06秒  pswpin/s pswpout/s
10时58分09秒      0.00      0.00
10时58分12秒      0.00      0.00
平均时间:      0.00      0.00
[root@centos79 ~]#

3.10.监控设备使用情况

命令:

sar -d 3 2

[root@centos79 ~]# sar -d 3 2
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

10时59分01秒       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
10时59分04秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分04秒    dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分04秒  dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分04秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分04秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

10时59分04秒       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
10时59分07秒   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分07秒    dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分07秒  dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分07秒  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10时59分07秒  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

平均时间:       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
平均时间:   dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:    dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:  dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:  dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:  dev253-2      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
[root@centos79 ~]#

3.11.监控网络接口的统计信息

命令:

sar 3 2 -n DEV

[root@centos79 ~]# sar 3 2 -n DEV
Linux 3.10.0-1160.102.1.el7.x86_64 (centos79) 	2023年12月01日 	_x86_64_	(2 CPU)

11时00分04秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11时00分07秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒     ens32      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒 vetha6a8a46      2.67      3.67      0.49      2.37      0.00      0.00      0.00
11时00分07秒 vethc265dbe      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒 veth7bacf9f      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒 veth8e6a01e     54.67     53.67      5.66      3.78      0.00      0.00      0.00
11时00分07秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒 virbr0-nic      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分07秒 br-806f281c40a3     57.33     57.33      5.37      6.15      0.00      0.00      0.00
11时00分07秒   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00

11时00分07秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11时00分10秒 br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分10秒     ens32      0.66      0.66      0.04      0.44      0.00      0.00      0.00
11时00分10秒 vetha6a8a46      4.32      5.98      1.10      3.14      0.00      0.00      0.00
11时00分10秒 vethc265dbe      0.66      0.33      0.10      0.22      0.00      0.00      0.00
11时00分10秒 veth7bacf9f      0.66      0.33      0.10      0.22      0.00      0.00      0.00
11时00分10秒 veth8e6a01e     54.82     53.82      6.17      3.89      0.00      0.00      0.00
11时00分10秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分10秒 virbr0-nic      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分10秒    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00
11时00分10秒 br-806f281c40a3     60.47     60.47      6.64      7.47      0.00      0.00      0.00
11时00分10秒   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00

平均时间:     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
平均时间: br-63af6643aa54      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:     ens32      0.33      0.33      0.02      0.22      0.00      0.00      0.00
平均时间: vetha6a8a46      3.49      4.83      0.79      2.76      0.00      0.00      0.00
平均时间: vethc265dbe      0.33      0.17      0.05      0.11      0.00      0.00      0.00
平均时间: veth7bacf9f      0.33      0.17      0.05      0.11      0.00      0.00      0.00
平均时间: veth8e6a01e     54.74     53.74      5.92      3.83      0.00      0.00      0.00
平均时间:        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间: virbr0-nic      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间: br-806f281c40a3     58.90     58.90      6.01      6.81      0.00      0.00      0.00
平均时间:   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00
[root@centos79 ~]#



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年12月06日 0

暂无评论

推荐阅读
  wwLZeziuqjLR   2023年12月06日   22   0   0 sarcentos
  wwLZeziuqjLR   2023年12月11日   29   0   0 Dockercentos
  LE2wsiBPlOhg   2023年12月06日   30   0   0 Dockercentos
  wwLZeziuqjLR   2023年12月08日   94   0   0 Dockercentosbash
  wwLZeziuqjLR   2023年12月07日   30   0   0 Dockercentos
  wwLZeziuqjLR   2023年12月06日   24   0   0 abTime数据centos