直接安装sysstat即可:yum -y install sysstat
[root@bogon ~]# sar -n DEV 1 2 | grep 'enp2s0f1' | grep -v grep
-bash: sar: 未找到命令
[root@bogon ~]# yum install sar
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
没有可用软件包 sar。
错误:无须任何处理
[root@bogon ~]# yum -y install sysstat
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 sysstat.x86_64.0.10.1.5-18.el7_7.1 将被 安装
--> 正在处理依赖关系 libsensors.so.4()(64bit),它被软件包 sysstat-10.1.5-18.el7_7.1.x86_64 需要
--> 正在检查事务
---> 软件包 lm_sensors-libs.x86_64.0.3.4.0-8.20160601gitf9185e5.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================================================================
Package 架构 版本 源 大小
================================================================================================================================
正在安装:
sysstat x86_64 10.1.5-18.el7_7.1 updates 315 k
为依赖而安装:
lm_sensors-libs x86_64 3.4.0-8.20160601gitf9185e5.el7 base 42 k
事务概要
================================================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:357 k
安装大小:1.2 M
Downloading packages:
(1/2): sysstat-10.1.5-18.el7_7.1.x86_64.rpm | 315 kB 00:00:05
(2/2): lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64.rpm | 42 kB 00:00:10
--------------------------------------------------------------------------------------------------------------------------------
总计 33 kB/s | 357 kB 00:00:10
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64 1/2
正在安装 : sysstat-10.1.5-18.el7_7.1.x86_64 2/2
验证中 : sysstat-10.1.5-18.el7_7.1.x86_64 1/2
验证中 : lm_sensors-libs-3.4.0-8.20160601gitf9185e5.el7.x86_64 2/2
已安装:
sysstat.x86_64 0:10.1.5-18.el7_7.1
作为依赖被安装:
lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7
完毕!
[root@bogon ~]# sar -n DEV 1 2 | grep 'enp2s0f1' | grep -v grep
[root@bogon ~]# sar -n DEV 1 2 | grep 'ens160' | grep -v grep
01时35分26秒 ens160 31.00 1.00 1.82 0.06 0.00 0.00 2.00
01时35分27秒 ens160 29.00 0.00 1.70 0.00 0.00 0.00 2.00
平均时间: ens160 30.00 0.50 1.76 0.03 0.00 0.00 2.00
[root@bogon ~]#