Linux網絡流量監控工具nethogs

       有時候會發現訪問Linux服務器特別卡頓或者登陸服務器SSH後臺進一步發現大量帶寬被佔用,有什麼簡單辦法能找出哪一個進程佔用了帶寬呢?Linux 監控流量的小工具很多,如 iftop, iptraf等,大都是統計和監控網卡流量的,以前有介紹iftop工具,今天介紹的NetHogs 有點特別,Nethogs 也是Linux下開源的網絡流量監控工具,它的特別之處在於能夠監控每一個進程的網絡帶寬佔用狀況,這樣能夠更直觀獲取網絡使用狀況服務器

nethogs - Net top tool grouping bandwidth per process微信

NetHogs  is  a small ’net top’ tool. Instead of breaking the traffic down per protocol or per subnet, like most such tools do, it groups bandwidth by process - and does not rely on a special kernel module to be loaded. So if there’s suddenly a lot of network  traffic,  you can fire up NetHogs and immediately see which PID is causing this, and if it’s some kind of spinning process, kill it.網絡

1、nethogs的下載安裝工具

一、yum 的方式安裝網站

[root@YuanFan-Aliyun ~]# yum install nethogsthis

二、也能夠去以下兩個網站去搜索下載rpm包url

1)http://rpmfind.net/spa

2)https://pkgs.org/download.net

下載好rpm包後,rz命令上傳到服務器,rpm -ivh安裝3d

[root@Storage ~]# rpm -ivh nethogs-0.8.5-1.el6.x86_64.rpm 

2、nethogs的使用

[root@Storage ~]# nethogs

默認eth0或者指定網卡,

[root@Storage ~]# nethogs eth0

如上圖所示,能夠看到./ARS ./MTS進程實時佔用的帶寬較大

nethogs的用法能夠參考man nethogs 或者nethogs -h

其餘參數和用法

-d : 刷新間隔

-h : 幫助

-p : promiscious 模式

-t : trace模式 

-v : 視圖模式

nethogs的交互命令(鍵盤快捷鍵)

m : 修改單位

r : 按流量排序

s : 按發送流量排序

q : 退出命令提示符


本文分享自微信公衆號 - WalkingCloud(WalkingCloud2018)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。

相關文章
相關標籤/搜索