nethogs安装部署

Ubuntu安装部署

apt-get -y install ncurses* 
apt-get -y install libpcap-dev libncurses5-dev
wget -c https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz
tar xvf v0.8.1.tar.gz
cd nethogs-0.8.1
make && make install

centos安装部署

wget https://github.com/raboof/nethogs/archive/v0.8.5.tar.gz
yum install libpcap-devel
yum install ncurses-devel
tar zxvf v0.8.5.tar.gz
cd nethogs-0.8.5/
make && make install

监控网络传输情况 

nethogs 网卡

NetHogs提供交互式控制指令:

m : Cycle between display modes (kb/s, kb, b, mb) 切换网速显示单位
r : Sort by received. 按接收流量排序
s : Sort by sent. 按发送流量排序
q : Quit and return to the shell prompt. 退出NetHogs命令工具

NetHogs 命令行参数

常用的参数:

-d delay for refresh rate. 数据刷新时间 如nethogs -d 1 就是每秒刷新一次

-h display available commands usage. 显示命名帮助、使用信息

-p sniff in promiscious mode (not recommended).

-t tracemode.

-V prints Version info.

演示例子:

#5秒刷新一次数据

nethogs -d 5

#监控网卡eth0数据

nethogs eth0

#同时监视eth0和eth1接口

nethogs eth0 eth1

#将监控日志写入日志文件

nethogs >>test.log

要查看这台设备上的总体带宽情况,可以使用nload、iftop、ifstat工具。 要查看这台设备上的每个进程连接的带宽情况,可以使用nethogs工具。

发布了161 篇原创文章 · 获赞 69 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/baidu_38432732/article/details/104522915