水之露 發表於 2023-8-11 00:00:00

nethogs 查看每个进程使用的带宽

<p>有些时候服务器莫名其妙的向外发送大量的包,占用大量带宽,导致其他服务器受到影响。ubuntu有个版本的系统,死机后会发大量的包,以致该服务器所连的交换机下的其他服务器全部瘫痪。那么在流量异常的情况下,如何查看每个进程使用的带宽呢?可以使用nethogs工具来查看。</p>
<p>1. 安装</p>
<p>先要安装EPEL源。</p><pre class="brush:bash;toolbar:false"># yum install nethogs libpcap-dev libpcap</pre><p>2. 使用</p><pre class="brush:bash;toolbar:false"># nethogs -h
usage: nethogs [-V] [-b] [-d seconds] [-t] [-p] ]]
                -V : 打印版本.
                -d : 延时多少秒刷新. 默认 1s.
                -t : 跟踪模式.
                -b : bughunt模式,隐式tracemode.
                -p : 嗅探在混合模式下(不推荐).
                device : 指定监控网卡设备. 默认eth0

When nethogs is running, press:
q: quit
m: switch between total and kb/s mode</pre><p><img src="https://zhuji.jb51.net/uploads/img/20230517/85c56dd489a0c2be6cee6bcd64c61571.jpg" width="649" height="447"></p>
<p>3. tracemode</p>
<p><img src="https://zhuji.jb51.net/uploads/img/20230517/8fd2e85a320892fb354e0ed100fccbe8.jpg" width="606" height="531"></p>
<p>这个还有个bug,有时统计不到。</p>
頁: [1]
查看完整版本: nethogs 查看每个进程使用的带宽