Linux sysstat 安装使用(3)

实例二:查看网络设备的吞吐情况;

比如我们让数据每2秒更新一次,总共更新5次;
[root@localhost ~]# sar -n DEV  2 5
时间    IFACE  rxpck/s  txpck/s  rxbyt/s  txbyt/s  rxcmp/s  txcmp/s  rxmcst/s

第一字段:时间;
IFACE:设备名;
rxpck/s:每秒收到的包;
rxbyt/s:每秒收到的所有包的体积;
txbyt/s:每秒传输的所有包的体积;
rxcmp/s:每秒收到数据切割压缩的包总数;
txcmp/s :每秒传输的数据切割压缩的包的总数;
rxmcst/s: 每秒收到的多点传送的包;
如果我们从事提取eth0设备(也就是网卡eth0)的信息;我们应该用grep 来过滤。然后再显示出来;


[root@localhost ~]# sar -n DEV  2  5  |grep eth0
11时52分37秒      eth0  1.00  1.00  97.51  97.51  0.00    0.00      0.00
11时52分39秒      eth0  1.01  1.01  98.49  98.49  0.00    0.00      0.00
11时52分41秒      eth0  1.00  1.00  98.00  98.00  0.00    0.00      0.00
11时52分43秒      eth0  1.00  1.00  98.00  98.00  0.00    0.00      0.00
11时52分45秒      eth0  1.00  1.00  98.00  98.00  0.00    0.00      0.00
Average:  eth0  1.00  1.00  98.00  98.00  0.00    0.00      0.00

如果想知道网络设备错误报告,也就就是用来查看设备故障的。应该用EDEV;比如下面的例子;


[root@localhost ~]# sar -n EDEV  2 5


3.3 iostat
iostat 是用来显示系统即时信息,比如CPU使用率,硬盘设备的吞吐率;

[root@localhost ~]# iostat
Linux 2.6.15-1.2054_FC5 (localhost.localdomain)  2006年05月12日

avg-cpu:  %user  %nice %system %iowait  %idle
          7.24    0.00    0.99    0.35  91.43

Device:  tps  Blk_read/s  Blk_wrtn/s  Blk_read  Blk_wrtn
hda      1.46        28.43        21.43    710589    535680

3.4 mpstat
mpstat 提供多处理器系统中的CPU的利用率的统计;mpstat 也可以加参数,用-P来指定哪个 CPU,处理器的ID是从0开始的。下面的例子是查看两个处理器,每二秒数据更新一次,总共要显示10次数据;
[root@localhost ~]# mpstat -P 0 2 10  注:查看第一个CPU
[root@localhost ~]# mpstat -p 1 2 10  注:查看第二个CPU
</code >

<code>
[root@localhost ~]# mpstat 2 10  注:查看所有CPU;


3.5 sdaf
sdaf 能从二进制文件中提取sar所收集的数据;这个大家知道就行了。显示的并不是友好的格式;
[root@localhost ~]# sar -u 2 5 -o sar003
[root@localhost ~]# sadf  sar003

相对来说,用sar来读取输出文件的内容更好;比如下面的;
[root@localhost ~]# sar -f sar003

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/19264.html