Latest News: Linux shell script to change you ssh port

Monitor Per Process Network Bandwidth Usage with Nethogs

Tutorial willing 379View(s) 0Comment

NetHogs is an open-source, 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.

Install NetHogs

On RHEL/CentOS, NetHogs is not available in official RHEL/CentOS repositories, so let us add EPEL repository to install NetHogs:

Install NetHags using the following command:

On Ubuntu/Debian:

Usage

Open up the terminal and enter the following command:

sk@sk: ~_005By default, NetHogs listens to eth0 interface and displays the bandwidth consumption of the processes. As you see above, the SENT and RECEIVED columns shows the amount of traffic being used around per process. The total bandwidth usage is shown in the TOTAL column.

To cycle between bandwidth usage units, hit “m” (Available units: KB/sec, KB, B, MB). To sort by “sent” traffic or “received” traffic, hit “s” or “r” respectively. You can quit nethogs by hitting “q”.

More Options

To listen a particular interface, for example eth1, enter the following command:

To monitor bandwidth usage of eth1 interface only, use the following command:

Also you can set refresh intervals use the parameter -d along with number of seconds.

For example, to set the refresh interval every 5 seconds, enter the following command:

For more information about NetHogs refer the man pages:

Source:https://www.unixmen.com/monitor-per-process-network-bandwidth-usage-with-nethogs/

Please give credit to the original author when you use it elsewhere: VPS List Agent » Monitor Per Process Network Bandwidth Usage with Nethogs

Login to post a comment!