CentOS7.3下安装接口流量工具-ifstat

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7.3下安装接口流量工具-ifstat相关的知识,希望对你有一定的参考价值。

CentOS版本:7.3

[[email protected] ifstat-1.1]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[[email protected] ifstat-1.1]#

下载ifstat软件包:

wget

解压ifstat-1.1.tar.gz

[[email protected] ~]# tar -zxvf ifstat-1.1.tar.gz

进入ifstat-1.1文件夹:

cd ifstat-1.1

检测安装环境:

[[email protected] ifstat-1.1]# ./configure 
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking for gcc... no
checking for cc... no
configure: error: no acceptable cc found in $PATH
[[email protected] ifstat-1.1]#

显示没有安装gcc和cc。

通过yum仓库安装gcc和cc:

[[email protected] ifstat-1.1]# yum -y install gcc cc

Installed:
  gcc.x86_64 0:4.8.5-11.el7                                                                                                                                                                                                                                                   

Dependency Installed:
  cpp.x86_64 0:4.8.5-11.el7                   glibc-devel.x86_64 0:2.17-157.el7_3.4                   glibc-headers.x86_64 0:2.17-157.el7_3.4                   kernel-headers.x86_64 0:3.10.0-514.21.2.el7                   libmpc.x86_64 0:1.0.1-3.el7                  

Dependency Updated:
  glibc.x86_64 0:2.17-157.el7_3.4                                                                                                    glibc-common.x86_64 0:2.17-157.el7_3.4                                                                                                   

Complete!
[[email protected] ifstat-1.1]#

重新检测安装环境:

[[email protected] ifstat-1.1]# ./configure
creating ./config.status
creating Makefile
creating config.h
[[email protected] ifstat-1.1]#

编译:

[[email protected] ifstat-1.1]#make
gcc -I. -g -O2 -DHAVE_CONFIG_H  -c ifstat.c -o ifstat.o
gcc -I. -g -O2 -DHAVE_CONFIG_H  -c drivers.c -o drivers.o
gcc -I. -g -O2 -DHAVE_CONFIG_H  -c data.c -o data.o
gcc ifstat.o drivers.o data.o   -o ifstat
[[email protected] ifstat-1.1]#

安装:

[[email protected] ifstat-1.1]#make install
/usr/bin/install -c -d -m 755 /usr/local/bin
/usr/bin/install -c -s -m 755 ifstat /usr/local/bin/ifstat
/usr/bin/install -c -d -m 755 /usr/local/man/man1
/usr/bin/install -c -m 644 ifstat.1 /usr/local/man/man1/ifstat.1
[[email protected] ifstat-1.1]#

此时ifstat安装完毕。

看看效果吧!

[[email protected] ifstat-1.1]# ifstat
      ens33               ens37               virbr0      
 KB/s in  KB/s out   KB/s in  KB/s out   KB/s in  KB/s out
    0.00      0.00      0.06      0.23      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.17      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00
    0.00      0.00      0.06      0.16      0.00      0.00


本文出自 “TommyKing” 博客,转载请与作者联系!

以上是关于CentOS7.3下安装接口流量工具-ifstat的主要内容,如果未能解决你的问题,请参考以下文章

网络接口的检測

使用iptraf,ifstat查看网络流量

zabbix使用ifstat工具来自定义获取网卡流量

每天学一个 Linux 命令(110):ifstat

linux下安装ifstat和iftop

Nethogs - 网络流量监控工具