kunpengmm
移植iftop
更新时间:2020/06/03 GMT+08:00
介绍
简要介绍
iftop是一款实时流量监控工具,监控TCP/IP连接等,缺点就是无报表功能。必须以root身份才能运行。
开发语言:C
一句话描述:一款实时流量监控工具
开源协议:GNU General Public License
建议的版本
根据实际需要选择版本,本文档以“iftop-0.17”为例进行说明。
配置编译环境
安装相关依赖包。
yum install wget libpcap libpcap-devel ncurses -y
获取源码
获取“iftop-0.17”源码包。
cd /usr/local/src
wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
编译和安装
- 解压软件包。
tar -zxvf iftop-0.17.tar.gz
- 进入iftop的安装目录。
cd iftop-0.17
- 修改配置“config.sub”。
vim config/config.sub
查找“x86”内容的位置,在其位置后面增加“aarch64”类型。
在“case $basic_machine in”区域的两个位置修改。
- 修改下述内容。
| x86 | xscale | xstormy16 | xtensa \
修改后为:
| x86 | aarch64 | xscale | xstormy16 | xtensa \
- 修改下述内容。
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
修改后为:
| x86-* | aarch64-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
- 修改下述内容。
- 配置iftop生成Makefile。
./configure --host=aarch64 --build=aarch64
- 编译和安装iftop。
make && make install
运行和验证
执行如下命令,查看iftop信息。
iftop -h
回显信息如下,则表示iftop安装成功。
iftop: display bandwidth usage on an interface by host Synopsis: iftop -h | [-npbBP] [-i interface] [-f filter code] [-N net/mask] -h display this message -n don't do hostname lookups -N don't convert port numbers to services -p run in promiscuous mode (show traffic between other hosts on the same network segment) -b don't display a bar graph of traffic -B Display bandwidth in bytes -i interface listen on named interface -f filter code use filter code to select packets to count (default: none, but only IP packets are counted) -F net/mask show traffic flows in/out of network -P show ports as well as hosts -m limit sets the upper limit for the bandwidth scale -c config file specifies an alternative configuration file iftop, version 0.17 copyright (c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors
