ablog

不器用で落着きのない技術者のメモ

nethogs でプロセス別の通信量を調べる

nethogs はネットワークの top コマンド的なもので通信量の多いプロセスをランキング表示して、秒間通信量も見ることができる。

インストール

sudo yum -y install gcc-c++ libpcap-devel.x86_64 libpcap.x86_64 ncurses*
git clone https://github.com/raboof/nethogs
cd nethogs
make
sudo make install

使ってみる

sudo /usr/local/sbin/nethogs

参考

NetHogs is a small 'net top' tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process.

NetHogs does not rely on a special kernel module to be loaded. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to identify programs that have gone wild and are suddenly taking up your bandwidth.

Since NetHogs heavily relies on /proc, most features are only available on Linux. NetHogs can be built on Mac OS X and FreeBSD, but it will only show connections, not processes.

https://github.com/raboof/nethogs


追記(2018/2/17):

Since NetHogs heavily relies on /proc, most features are only available on Linux. NetHogs can be built on Mac OS X and FreeBSD, but it will only show connections, not processes.

https://github.com/raboof/nethogs

macOS Sierra 10.12.6 でも普通に使えた。

% git clone https://github.com/raboof/nethogs
% cd nethogs
% make
% sudo make install
% sudo /usr/local/sbin/nethogs