代码改变世界

系统性能工具篇(sar)

2019-01-25 12:48  Loull  阅读(903)  评论(0编辑  收藏  举报

转自:系统性能工具篇(sar)


1. 介绍

  • 内容很多
  • 是sysstat软件包的一部分
  • 自动运行:/etc/crontab/sysstat

    $ cat /etc/cron.d/sysstat
    # The first element of the path is a directory where the debian-sa1
    # script is located
    PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin
    
    # Activity reports every 10 minutes everyday
    5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
    
    # Additional run at 23:59 to rotate the statistics file
    59 23 * * * root command -v debian-sa1 > /dev/null && debian-sa1 60 2
    
  • 内存相关的参数

    • -B:换页统计信息
    • -H:大页面统计信息
    • -r:内存使用率
    • -R:内存统计信息
    • -S:交换空间统计信息
    • -W:交换统计信息

2. 默认监控:系统资源

$ sar 1 2
Linux 4.2.0-27-generic (ubuntu)         07/25/2016      _x86_64_        (2 CPU)

08:02:28 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
08:02:29 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
08:02:30 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
Average:        all      0.00      0.00      0.25      0.00      0.00     99.75

3. 内存统计信息

  • 报告分页统计数据

    $ sar -B 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/25/2016      _x86_64_        (2 CPU)
    
    08:03:43 PM  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
    08:03:44 PM      0.00      0.00    169.00      0.00    241.00      0.00      0.00      0.00      0.00
    08:03:45 PM      0.00      0.00     20.00      0.00     61.00      0.00      0.00      0.00      0.00
    Average:         0.00      0.00     94.50      0.00    151.00      0.00      0.00      0.00      0.00
    
    pgpgin/s:  每秒系统从磁盘置入分页的总量(KB)
    pgpgout/s: 移出分页到磁盘
    fault/s:   系统每秒产生分页错误(major + minor)
    majflg/s:  系统每秒产生主要错误数量,需要从磁盘加载一个内存分页
    pgfree/s:  系统每秒放置在空闲列表的分页数量 
    pgscank/s: 每秒kswapd守护进程扫描的分页数量
    pgscand/s: 每秒直接扫描的分页数量
    pgsteal/s: 每秒系统从缓存回收的分页数量
    %vmeff:       pgsteal/pgscan 度量分页回收效率,太低说明虚拟内存有问题
    
  • 大页面统计信息

    $ sar -H 1                                                                       
    Linux 4.2.0-27-generic (ubuntu)         11/08/2016      _x86_64_        (2 CPU)
    
    04:45:34 AM kbhugfree kbhugused  %hugused                                      
    04:45:35 AM         0         0      0.00                                      
    04:45:36 AM         0         0      0.00                                      
    04:45:37 AM         0         0      0.00                                      
    04:45:38 AM         0         0      0.00                                      
    04:45:39 AM         0         0      0.00                                      
    ^C                                                                             
    
    04:45:40 AM         0         0      0.00                                      
    Average:            0         0      0.00  
    
    kbhugfree:空闲大页面存储器
    kbhugused:使用的大页面存储器
    %hugused :使用百分比
    
  • 系统交换的统计数据

    $ sar -W 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)
    
    08:26:21 PM  pswpin/s pswpout/s
    08:26:22 PM      0.00      0.00
    08:26:23 PM      0.00      0.00
    
    pswpin/s :每秒换入的swap分页数量
    pswpout/s:换出
    
  • 任务创建和系统切换活动

    $ sar -w 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)
    
    08:27:51 PM    proc/s   cswch/s
    08:27:52 PM      0.00     82.00
    08:27:53 PM      1.00    128.00
    Average:         0.50    105.00
    
    proc/s :每秒创建任务总数   
    cswch/s:每秒上下文切换总数
    
  • 内存统计数据

    $ sar -R 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)
    
    08:01:26 PM   frmpg/s   bufpg/s   campg/s
    08:01:27 PM     -1.98      0.00      0.00
    08:01:28 PM      0.00      0.00      0.00
    Average:        -1.00      0.00      0.00
    
    frmpg/s:系统每秒释放内存分页数量,-表示分配的数量   
    bufpg/s:系统每秒使用额外内存作为缓冲区的数量,-表示系统使用较少的分页作为缓冲区
    campg/s:系统每秒似乎呀额外内存作为缓存的数量,-表示缓存中有较少的分页
    
  • 内存使用率

    $ sar -r 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)
    
    08:04:42 PM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
    08:04:43 PM    362856   1677152     82.21     47896   1321820    877840     21.22    952452    537044         0
    08:04:44 PM    362856   1677152     82.21     47896   1321820    877840     21.22    952452    537044         0
    Average:       362856   1677152     82.21     47896   1321820    877840     21.22    952452    537044         0
    
    kbmemfree:可用空闲内存数量,KB
    kbmemused:已使用内存数量,KB
    %memused:使用率
    kbbuffers:内核用作缓冲区的内存数量,KB
    kbcached:内核用作缓存的内存数量,KB
    kbcommit:当前工作负载需要的内存数量,KB,是对RAM/swap的估计,以保证永远不会内存不足   
    %commit:相对于总内存,当前工作负载需要的内存百分比,当内核过量使用内存时会大于100% 
    kbactive:活跃内存数量,KB,最近使用的内存通常不会回收
    kbinact:非活跃内存数量,KB,最近很少使用,更可能被回收
    kbdirty:等待回写到磁盘的内存数量,KB
    

4. 报告IO和传输速率

$ sar -b 1 2
Linux 4.2.0-27-generic (ubuntu)         07/25/2016      _x86_64_        (2 CPU)

08:10:03 PM       tps      rtps      wtps   bread/s   bwrtn/s
08:10:04 PM      0.00      0.00      0.00      0.00      0.00
08:10:05 PM      0.00      0.00      0.00      0.00      0.00
Average:         0.00      0.00      0.00      0.00      0.00

tps:  每秒物理传输总数,一个传输就是一次物理IO,发送到设备的多个逻辑IO可以合并为单个物理IO    
rtps: 每秒读请求总数
wtps: 每秒写请求总数
bread/s: 每秒写入的设备的数据总量(块)

5. 每个块设备的活动

$ sar -dp 1 1
Linux 4.2.0-27-generic (ubuntu)         07/25/2016      _x86_64_        (2 CPU)

08:14:30 PM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
08:14:31 PM       sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
08:14:31 PM       sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
08:14:31 PM ubuntu--vg-root      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
08:14:31 PM ubuntu--vg-swap_1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Average:          DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
Average:          sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:    ubuntu--vg-root      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:    ubuntu--vg-swap_1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

p显示可读的设备名,否则以dev主-次的方式显示
tps:同上
rd_sec/s:每秒读取的扇区数,扇区大小512  
wr_sec/s:每秒写入的扇区数  
avgrq-sz:请求的平均大小,扇区
avgqu-sz:请求队列的平均长度
await:请求到被服务的平均时间,毫秒,包括请求在队列和服务花费的时间
svctm:请求的平均服务时间,毫秒     
%util:请求发出到设备期间CPU时间的百分比,即设备带宽使用率,接近100%时设备饱和

6. 中断

$ sar -I SUM 1 2
Linux 4.2.0-27-generic (ubuntu)         07/25/2016      _x86_64_        (2 CPU)

08:23:04 PM      INTR    intr/s
08:23:05 PM       sum     74.00
08:23:06 PM       sum     59.00
Average:          sum     66.50

INTR:中断号
关键字:SUM|ALL|XALL
SUM:每秒的中断总数
ALL:前16个中断的统计数据
XALL:所有中断的统计数据

7. 电源管理

~$ sar -m ALL 1 2
Linux 4.2.0-27-generic (ubuntu)         07/25/2016      _x86_64_        (2 CPU)

08:25:34 PM     CPU       MHz
08:25:35 PM     all   2800.15

08:25:34 PM    TEMP      degC     %temp               DEVICE
08:25:35 PM       1    100.00    100.00    coretemp-isa-0000
08:25:35 PM       2    100.00    100.00    coretemp-isa-0000

08:25:34 PM     BUS  idvendor    idprod  maxpower                manufact                                         product
08:25:35 PM       2       e0f         3         0                  VMware                        VMware Virtual USB Mouse
08:25:35 PM       2       e0f         2         0                                                  VMware Virtual USB Hub

08:25:35 PM     CPU       MHz
08:25:36 PM     all   2800.15

08:25:35 PM    TEMP      degC     %temp               DEVICE
08:25:36 PM       1    100.00    100.00    coretemp-isa-0000
08:25:36 PM       2    100.00    100.00    coretemp-isa-0000

08:25:35 PM     BUS  idvendor    idprod  maxpower                manufact                                         product
08:25:36 PM       2       e0f         3         0                  VMware                        VMware Virtual USB Mouse
08:25:36 PM       2       e0f         2         0                                                  VMware Virtual USB Hub

Average:        CPU       MHz
Average:        all   2800.15

Average:       TEMP      degC     %temp               DEVICE
Average:          1    100.00    100.00    coretemp-isa-0000
Average:          2    100.00    100.00    coretemp-isa-0000

Summary         BUS  idvendor    idprod  maxpower                manufact                                         product
Summary           2       e0f         3         0                  VMware                        VMware Virtual USB Mouse
Summary           2       e0f         2         0                                                  VMware Virtual USB Hub


CPU
    MHz:瞬时时钟频率
FAN
    rpm:每分钟转速
    drpm:当前转速与下限的差异
    DEVICE:传感器名称
FREQ
    wghMHz:CPU时钟频率加权值,MHz,需要编译cpufreq-stats驱动
IN
    inV:电压输入伏特
    %in:相对输入,100%为输入到达上限,0为下限
    DEVICE:传感器名称
TEMP
    degC:摄氏度
    %temp:相对温度,同上
    DEVICE:传感器名称
USB
    BUS:根集线器数量
    Idvendor:供应商ID
    Idprod:产品ID
    Maxpower:最大功耗mA
    Manufact:制造商名称
    Product:产品名称

8. 队列长度和平均负载

$ sar -q 1 2
Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)

07:56:41 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
07:56:42 PM         0       229      0.07      0.05      0.05         0
07:56:43 PM         0       229      0.07      0.05      0.05         0
Average:            0       229      0.07      0.05      0.05         0

runq-sz: 运行队列长度(等待运行时间的任务数)  
plist-sz:在任务列表中的任务数量
ldavg-1:最后1分钟的系统平均负载
ldavg-5:5分钟
ldavg-15:15分钟
blocked:
*平均负载:在指定时间间隔。运行态(R)任务的平均数量和不可中的睡眠态(D)任务数量

9. swap空间使用率

$ sar -S 1 2
Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)

08:11:24 PM kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
08:11:25 PM   2094020      3128      0.15       588     18.80
08:11:26 PM   2094020      3128      0.15       588     18.80
Average:      2094020      3128      0.15       588     18.80

kbswpfree:空闲swap空间数量,KB
kbswpused:已使用swap空间数量,KB
%swpused:已使用swap空间百分比
kbswpcad:缓存的swap内存数量,KB,已在swap区域的缓存不用换入换出,节省IO
%swpcad:已缓存的sawap内存百分比

10. 所有CPU使用率

$ sar -u ALL 1 2
Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)

08:16:15 PM     CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
08:16:16 PM     all      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00    100.00
08:16:17 PM     all      0.00      0.00      0.50      0.00      0.00      0.00      0.00      0.00      0.00     99.50
Average:        all      0.00      0.00      0.25      0.00      0.00      0.00      0.00      0.00      0.00     99.75

%usr  :用户态cpu,包含虚拟处理器时间    
%nice :用户态nice优先级执行时cpu
%sys  :内核态cpu,不包括软硬中断时间
%iowait:磁盘io时的cpu空闲时间
%steal:hypervisor为另一个虚拟处理器服务时,一个或多个虚拟cpu非主动等待的cpu时间      
%irq  :硬中断cpu 
%soft :软中断cpu 
%guest:cpu运行虚拟处理器的时间
%gnice:cpu运行nice虚拟机花费的时间
%idle :空闲cpu

11. inode状态、文件和其它内核表

$ sar -v 1 2
Linux 4.2.0-27-generic (ubuntu)         07/26/2016      _x86_64_        (2 CPU)

08:23:13 PM dentunusd   file-nr  inode-nr    pty-nr
08:23:14 PM     37269      1856     29503         5
08:23:15 PM     37269      1856     29503         5
Average:        37269      1856     29503         5

dentunusd:在目录缓存中未使用的缓存条目数量   
file-nr:系统使用的文件数量
inode-nr: 系统使用的inode数量
pty-nr: 系统使用的伪终端数量

12. 网络

  • DEV - 网络设备

    $ sar -n DEV 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:00:25 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
    08:00:26 PM      eth0     22.00      0.00      1.35      0.00      0.00      0.00      0.00      0.00
    08:00:26 PM   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:00:26 PM    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:00:26 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    ^C
    
    08:00:26 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
    08:00:26 PM      eth0     16.25      6.25      1.01      1.25      0.00      0.00      0.00      0.00
    08:00:26 PM   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:00:26 PM    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:00:26 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    
    Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
    Average:         eth0     19.44      2.78      1.20      0.56      0.00      0.00      0.00      0.00
    Average:      docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    Average:       virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    
    rxpck/s :接收包数  
    txpck/s :发送包数  
    rxkB/s  :接收数据量,KB  
    txkB/s  :发送数据量,KB 
    rxcmp/s :接收压缩数据包数量  
    txcmp/s :发送压缩数据包数量
    rxmcst/s:接收多播数据包数量
    %ifutil :
    
  • EDEV - 网络设备故障

    $ sar -n EDEV 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:04:17 PM     IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
    08:04:18 PM      eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:04:18 PM   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:04:18 PM    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:04:18 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    ^C
    
    08:04:18 PM     IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
    08:04:18 PM      eth0      0.00      0.00      0.00      1.72      0.00      0.00      0.00      0.00      0.00
    08:04:18 PM   docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:04:18 PM    virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:04:18 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    
    Average:        IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
    Average:         eth0      0.00      0.00      0.00      0.63      0.00      0.00      0.00      0.00      0.00
    Average:      docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    Average:       virbr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    
    rxerr/s :接收错误
    txerr/s :发送错误   
    coll/s  :发送数据包冲突
    rxdrop/s:接收缓存不足时每秒丢弃
    txdrop/s:发送缓存不足时每秒丢弃
    txcarr/s:发送时发生载波错误  
    rxfram/s:接收时发生帧同步错误
    rxfifo/s:接收时FIFO溢出
    txfifo/s: 发送时FIFO溢出
    
  • NFS - NFS客户端活动

    $ sar -n NFS 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:10:22 PM    call/s retrans/s    read/s   write/s  access/s  getatt/s
    08:10:23 PM      0.00      0.00      0.00      0.00      0.00      0.00
    08:10:24 PM      0.00      0.00      0.00      0.00      0.00      0.00        
    
    08:10:25 PM      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
    
    call/s  : 产生RPC请求数量
    retrans/s:重传RPC请求数量  
    read/s  :read RPC调用数量
    write/s :write
    access/s:access
    getatt/s:getattr 
    
  • NFSD - NFS服务端活动

    $ sar -n NFSD 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:13:00 PM   scall/s badcall/s  packet/s     udp/s     tcp/s     hit/s    miss/s   sread/s  swrite/s saccess/s sgetatt/s
    08:13:01 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:13:02 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    
    ^C
    08:13:02 PM      0.00      0.00      0.00      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      0.00      0.00      0.00
    
    scall/s  :接收RPC请求数量
    badcall/s:接收错误RPC请求数量  
    packet/s :接收网络数据包数量    
    udp/s    :接收UDP包数量 
    tcp/s    :接收TCP包数量
    hit/s    :回复缓存命中数量 
    miss/s   :回复缓存未命中数量
    sread/s  :接收read RPC调用数量
    swrite/s :write
    saccess/s:access
    sgetatt/s:getattr
    
  • SOCK - IPv4 socket

    $ sar -n SOCK 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:17:11 PM    totsck    tcpsck    udpsck    rawsck   ip-frag    tcp-tw
    08:17:12 PM       361        15        20         0         0         0
    08:17:13 PM       361        15        20         0         0         0
    ^C
    08:17:14 PM       361        15        20         0         0         0
    Average:          361        15        20         0         0         0
    
    totsck :系统使用的socket总数   
    tcpsck :tcp数量   
    udpsck :udp数量
    rawsck :raw数量   
    ip-frag:当前队列IP分片数量    
    tcp-tw :出于TIME_WAIT的数量
    
  • IP - IPv4数据包

    $ sar -n IP 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:19:30 PM    irec/s  fwddgm/s    idel/s     orq/s   asmrq/s   asmok/s  fragok/s fragcrt/s
    08:19:31 PM      1.00      0.00      1.00      0.00      0.00      0.00      0.00      0.00
    08:19:32 PM      3.00      0.00      3.00      1.00      0.00      0.00      0.00      0.00
    ^C
    08:19:33 PM      6.58      0.00      6.58      3.95      0.00      0.00      0.00      0.00
    Average:         3.26      0.00      3.26      1.45      0.00      0.00      0.00      0.00
    
    irec/s  :每秒收到数据包数量,包括错误接收  
    fwddgm/s:收到的需要转发数据包数量,非最终目的IP    
    idel/s  :收到数据包成功传递到IP协议的数量,包括ICMP   
    orq/s   :本地IP协议栈到IP传输请求的数据包总数,包括ICMP
    asmrq/s :收到的需要重组的IP分片数量  
    asmok/s :成功重组的的IP数据包数量 
    fragok/s:成功分片的IP数据包数量
    fragcrt/s:生成的IP数据包分片数量
    
  • EIP - IPv4 网络错误

    $ sar -n EIP 1
    Linux 4.2.0-27-generic (ubuntu)         07/27/2016      _x86_64_        (2 CPU)
    
    08:26:24 PM ihdrerr/s iadrerr/s iukwnpr/s   idisc/s   odisc/s   onort/s    asmf/s   fragf/s
    08:26:25 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    08:26:26 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    ^C
    08:26:27 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
    
    ihdrerr/s:因为IP头错误,丢弃的输入数据包,包括CS、版本、格式、TTL、OPT等
    iadrerr/s: 因为目标地址非法,丢弃的输入数据包
    iukwnpr/s: 成功接收但因为协议错误丢弃的数据包  
    idisc/s  : 接收IP数据报数量,不包括丢弃的包
    odisc/s  : 发送,不包括丢弃的包
    onort/s  : 因为路由不正确丢弃的IP数据报数量
    asmf/s   : 通过重组算法检测到的故障数量,不一定是丢弃的分片数量
    fragf/s  : 因为无法分片丢弃的IP数据报数量
    
  • ICMP

    ~$ sar -n ICMP 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/28/2016      _x86_64_        (2 CPU)
    
    07:44:53 PM    imsg/s    omsg/s    iech/s   iechr/s    oech/s   oechr/s     itm/s    itmr/s     otm/s    otmr/s  iadrmk/s iadrmkr/s  oadrmk/s oadrmkr/s
    07:44:54 PM      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
    ^C
    07:44:55 PM      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
    Average:         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
    
    imsg/s :接收消息总数,包括错误    
    omsg/s :发送消息总数,包括错误   
    iech/s :接收Echo request消息总数  
    iechr/s:接收Echo reply消息总数
    oech/s :发送Echo request消息总数  
    oechr/s:接收Echo reply消息总数     
    itm/s  :接收Timestamp request消息总数  
    itmr/s :接收Timestamp reply消息总数    
    otm/s  :发送Timestamp request消息总数  
    otmr/s :发送Timestamp reply消息总数  
    iadrmk/s :接收Address Mask request消息总数
    iadrmkr/s:发送Address Mask reply消息总数  
    oadrmk/s :接收Address Mask request消息总数
    oadrmkr/s:发送Address Mask reply消息总数
    
  • EICMP

    $ sar -n EICMP 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/28/2016      _x86_64_        (2 CPU)
    
    07:50:06 PM    ierr/s    oerr/s idstunr/s odstunr/s   itmex/s   otmex/s iparmpb/s oparmpb/s   isrcq/s   osrcq/s  iredir/s  oredir/s
    07:50:07 PM      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
    07:50:08 PM      0.00      0.00      0.00      0.00      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      0.00      0.00      0.00      0.00
    
    ierr/s   :接收到的ICMP消息体错误的消息数量    
    oerr/s   :无法发送的内部错误的ICMP消息
    idstunr/s:接收的ICMP目的不可达消息数量 
    odstunr/s:发送的ICMP目的不可达消息数量   
    itmex/s  :接收的ICMP超时消息数量  
    otmex/s  :发送的ICMP超时消息数量
    iparmpb/s:接收的ICMP参数错误的消息数量 
    oparmpb/s:发送的ICMP参数错误的消息数量
    isrcq/s  :接收的ICMP源抑制消息数量  
    osrcq/s  :发送的ICMP源抑制消息数量
    iredir/s :接受的ICMP重定向消息数量 
    oredir/s :发送的ICMP重定向消息数量
    
  • TCP

    $ sar -n TCP 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/28/2016      _x86_64_        (2 CPU)
    
    07:56:45 PM  active/s passive/s    iseg/s    oseg/s
    07:56:46 PM      0.00      0.00      0.00      0.00
    07:56:47 PM      0.00      0.00      1.00      1.00
    Average:         0.00      0.00      0.50      0.50
    
    active/s :连接从CLOSED转到SYN-SENT状态的次数
    passive/s:连接从LISTEN转到SYN-RCVD状态的次数    
    iseg/s   :接收到的分段数,包括错误的分段 
    oseg/s   :发送的分段数,不包含重发的字节数
    
  • ETCP

    $ sar -n ETCP 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/28/2016      _x86_64_        (2 CPU)
    
    07:59:34 PM  atmptf/s  estres/s retrans/s isegerr/s   orsts/s
    07:59:35 PM      0.00      0.00      0.00      0.00      0.00
    07:59:36 PM      0.00      0.00      0.00      0.00      0.00
    Average:         0.00      0.00      0.00      0.00      0.00
    
    atmptf/s :连接从SYN-SENT或SYN-RCVD直接转为CLOSED,加上从SYN-RCVD直接转为LISTEN状态的次数  
    estres/s :连接从ESTABLISHED或CLOSE-WAIT直接转为CLOSED状态的次数
    retrans/s:重传的分段数,即TCP分段包含了一个或多个之前的字节
    isegerr/s:接收的错误分段数   
    orsts/s  :发送的RST分段数
    
  • UDP

    $ sar -n UDP 1 2
    Linux 4.2.0-27-generic (ubuntu)         07/28/2016      _x86_64_        (2 CPU)
    
    08:06:01 PM    idgm/s    odgm/s  noport/s idgmerr/s
    08:06:02 PM      4.00      0.00      0.00      0.00
    08:06:03 PM      1.98      0.00      0.00      0.00
    Average:         2.99      0.00      0.00      0.00
    
    idgm/s :接收的UDP报文数   
    odgm/s :发送的UDP报文数 
    noport/s :接收的目标端口为0的报文数 
    idgmerr/s:接收的因缺乏目标端口而不能处理的报文数