sar 命令的参数

根据Linux中的sar命令,总结了一下sar命令的常用参数


 

 

 

Sar相关环境:

S_TIME_FORMAT:If this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. The sar command will use the ISO 8601 format (YYYY-MM- DD) instead.

 

Sar能工作,/proc目录必须被mount上来

 

 

 

CPU

-u

-P

 

内存

-r

-R

 

Block device情况

-d

 

I/O

-b

 

页交换情况

-B

 

进程

-c

 

网络

-n

 

机器负载

-q

 

Swap

-W

 

 

 

 

 

 

全部的信息

-A

 

CPU使用率 – 缺省

Report CPU utilization

-u

%user: Percentage of CPU utilization that occurred while exe cuting at the user level (application).

%nice:at the user level with nice priority

%system:at the system level (kernel).

%iowait:Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request

%idle: Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request

CPU情况

-P cpu | ALL

统计单个或多个cpu的情况

ALL:再加上整体统计情况

-u 和–I SUM 2个参数跟着-P有意义。

 

 

 

内存使用率

Report memory and swap space utilization statistics

-r

所有的数量单位: kbytes

Kbmemfree、Kbmemused、%memused:

内存空闲、使用了,使用的%

Kbbuffers:内核当作buffer使用的内存

Kbcached::内核当作cache data使用的内存

Kbswpfree、Kbswpused、%swpused

Swap使用的3个值

Kbswpcad:缓存的swap空间。这个意思是:内存被swap out,又立即swap back in,但是还存在swap中,(如果memory需要,memory不需要再次swap out了,它在swap已经存在,节省了I/O)

 

内存使用统计

Report memory statistics

-R

frmpg/s:系统释放的内存页数量,如果是负数表示被系统分配的数量。内存页时4k或8k和系统架构有关。

bufpg/s:系统用作buffer的增量内存页

campg/s:系统用作cache的增量内存页

 

 

 

I/O和传输统计

I/O and tranfer statistics

-b

只在Kernal2.5以前的版本中才有效

Tps:物理磁盘每秒总的传输量。多个逻辑的请求可能被合并成一个单独的磁盘请求。

Rtps:读的请求

Wtps:写的请求

Bread/s:每秒从磁盘读的块数

Wread/s:每秒写的块数

页的统计消息

Paging statistics

-B

Pgpgin/s: 每秒磁盘page in的数量(kbytes)

Pgpgout/s:每秒磁盘page out的量(kbytes)

Fault/s:系统每秒page faults(major+minor)的数量(2.5以上kernal)

majflt/s:系统每秒产生的major faults数量(2.5以上kernel)

进程

Process creation

-c

Proc/s:每秒产生的进程数量

Block device性能

-d

2.4或以上版本有

Devm-n: m:device的major number

n: device的 minor number(kernal 2.5)

tps: 设备的每秒传输量

rd_sec/s:设备的读的扇区数量(512k/sector)

wr_sec/s : 设备写的扇区数量(512k/sector)

采用文件

-f : 从。。读

-o: 写入。。。

从文件中获取数据(由-o产生的文件)

缺省值是current daily data file(/var/log/sa/sadd)

-f排斥-o参数

改变间隔时间

-i interval

单位是秒

网络情况

-n

-n DEV | EDEV | SOCK | FULL

 

DEV参数:

Network devices 的统计信息被报告

IFACE:设备名字

rxpck/s:每秒收到的包(package)

txpck/s:每秒传输的包

rxbyt/s:每秒收到的字节

txbyt/s:每秒传输的字节

rxcmp/s:每秒收到的压缩包(如cslip..)

txcmp/s:

rxmcst/s: 每秒收到的广播包

EDEV:

错误的统计信息

rxerr/s, txerr/s

coll/s: 传输过程中遇到的冲突包

rxdrop/s, txdrop/s:由于缺少Linux缓存区,被丢弃的接收/传输包

txcarr/s: 传输包时候遇到的carrier-errors数量

rxfram/s:接收frame对列错误数量

rxfifo/s:接收FIFO overrun错误数量

txfifo/s:传输的FIFO overrun错误数量

 

SOCK:

使用中的socket统计

Totsck: 使用中的socket

Tcpsck: tcp socket

Udpsck:

Rawsck:

ip-frag: Number of IP fragments currently in use.

机器负载

Report queue length and load averages

-q

runq-sz:运行的队列长度(number of processes waiting for run time)

plist-sz: (Number of processes in the process list)

ldavg-1、ldavg-5、ldavg-15:

1、5、15分钟平均负载

 

 

 

文件

Report status of inode, file and other kernel tables

-v

Dentunusd:Number of unused cache entries in the directory cache
file-sz:Number of used file handles

inode-sz:Number of used file handles

super-sz、%super-sz: Number of super block handlers allocated by the kerne。(regard to the maximum number of super block handlers that Linux can allocate)

dquot-sz、%dquot-sz:Number of allocated disk quota entries (regard to the maximum number of cached disk quota entries that can be allocated)

rtsig-sz、%rtsig-sz:Number of queued RT signals.(regard to the maxi mum number of RT signals that can be queued)

Report system switching activity

-w

cswch/s:Total number of context switches per second.

Swap:

Report swapping statistics

-W

pswpin/s: Total number of swap pages the system brought in per second

pswpout/s:Total number of swap pages the system brought out per second

 

 

 

Process相关

-x

-X

 

 

 

 

 

 

 

改变格式

-h

-H

 

设定时间

 

-e hh:mm:ss:结束时间

-s 开始时间

设置报告的截止时间。缺省的截止时间是18:00:00, 给出的时间必须24小时制。

这个参数只有当数据从文件中读写时候才有效(-f / -o 参数)。

如果同时使用-h参数,给出的时间是UTC时间

 


 

你可能感兴趣的:(linux,命令,参数,sar)