sar(System Activity Reporter 系统活动情况报告)是目前 Linux 上最为全面的系统性能分析工具之一,可以从多方面对系统的活动进行报告,但我们一般用来监控网卡流量
[root@localhost ~]$ yum install -y sysstat # 安装sar命令
[root@localhost ~]$ sar -n DEV 1 5 # 查看网卡流量,表示每隔一秒钟输出一次,总共输出五次
查看网卡流量:
[root@center /data]# sar -n DEV 1 5 Linux 2.6.32-504.1.3.el6.x86_64 (center) 01/21/2019 _x86_64_ (8 CPU) 11:30:08 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 11:30:09 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:30:09 AM eth0 1432.99 3226.80 113.69 4432.38 0.00 0.00 0.00 11:30:09 AM eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:30:09 AM eth2 0.00 0.00 0.00 0.00 0.00 0.00 0.00
时间,具体的网卡名称,每秒接收的数据包的数量,每秒发送的数据包的数量,每秒接收的字节数大小,每秒发送的字节数大小,每秒接收的压缩数据包的数量,每秒发送的压缩数据包的数量,每秒接收的多播数据包的数量