brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: nethogs adds per program network monitoring to your toolbox

Monitoring
~/tips/tip-monitoring-nethogs-per-process

sudo apt install nethogs

Find which process is using the bandwidth right now.

The router graph says the connection is full. The question is which program on this machine is filling it, and most traffic tools only list addresses and ports.

nethogs groups traffic by process:

sudo apt install nethogs
sudo nethogs eth0

You get a live table with the process ID, user, program, interface and the sent and received rates. Leave out the interface and it picks one itself.

A few keys help while it runs. m switches between rates and running totals, s sorts by sent traffic, r by received, and q quits. For a calmer screen, refresh less often:

sudo nethogs -d 5 eth0

Once I know the process, the follow up is easy: check what it is with ps -fp and its ID, then decide whether it should be doing that. A backup client, a package update or a media server streaming to someone are the usual answers.

It needs root because it watches the network traffic itself. Some connections end up under an unknown entry, typically short lived ones. Containers can appear in odd ways or not at all on the host view, depending on their network mode. And it shows the present only, so use something like vnstat for history.

Further reading: nethogs man page

Going deeper: Keep a domain pointed at your home with Cloudflare DDNS on Unraid

More Monitoring tips sudo apt install vnstat sudo apt install sysstat glances -w All Monitoring tips (4) All topics

Link