atop icon indicating copy to clipboard operation
atop copied to clipboard

Use DKMS to build netatop kernel module

Open RogueScholar opened this issue 7 years ago • 5 comments

Is there a reason this isn't already implemented? I was about to dig into the man page for DKMS and see if I couldn't figure it out, then I thought it'd be prudent to ask those who've been active on the project if it was even a worthwhile endeavor. All thoughts and experiences are welcome.

RogueScholar avatar Mar 29 '18 14:03 RogueScholar

archlinux users can use this package for such functionality https://aur.archlinux.org/packages/netatop-dkms/

hdhoang avatar Mar 30 '18 01:03 hdhoang

My discovery: nethogs can display network traffic per process without any additional modules. I don't know how it is implemented.

denizzzka avatar Jan 10 '20 18:01 denizzzka

nethogs uses libpcap, which asks the kernel to mirror all incoming and outgoing packets to the nethogs process. This lets it see source and destination IPs and ports, and packet length. I believe nethogs then looks in /proc to figure out who is using those IP:port combinations to figure out associated user/program. This fails when you have multiple programs using the same IP:port, either via SO_REUSEPORT or by not closing a file descriptor after fork(). It's good enough for most cases, bit netatop knows which process sent or received the packet.

perkinslr avatar Aug 07 '20 19:08 perkinslr

~Nice write-up. Thank you for that. I haven't dug into the sources (yet) for netatop (atop). What does netatop use if not libpcap for network traffic inspection/monitoring?~

Never mind. The netatop homepage mentions that netfilter is used.

ILMostro avatar Jan 09 '22 03:01 ILMostro

Are there any plans to use DKMS to build netatop?

It is always a hassle to remember to rebuild the netatop module when the kernel changes.

tbjornli avatar Oct 20 '22 14:10 tbjornli