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工具。