I. Introduction of Nethogs
Share a check on the bandwidth usage of the detection system process under Linux. Open source tools from GitHub.
It does not rely on modules in the kernel. When our server network is abnormal, you can run the Nethogs program to detect that the program is taking up a lot of bandwidth. Find time saved.
Second, installation method
1. You can install the Yum directly in the Epel source
Yum Install Libpcap nethogs-y
2. Source Mode installation
2.1 Installing the C + + environment
[email protected] ~]# Yum install gcc-c++ libpcap-devel.x86_64 libpcap.x86_64 ncurses*
2.2 Download the compiled binary file
[[email protected] ~]# git clone https://github.com/raboof/nethogsInitialized empty git repository in/root/nethogs/.git /remote:counting objects:1193, done.remote:Total 1193 (Delta 0), reused 0 (Delta 0), pack-reused 1193Receiving objects: 100% (1193/1193), 1.22 MiB | KIB/S, done. Resolving deltas:100% (789/789), done.
2.3 Compiling and installing
[[Email protected] ~]# CD Nethogs/[[email protected] nethogs]# Make[[email protected] nethogs]# make install
Complete the above steps even if the installation is complete. If the compilation fails, most of them are missing the compilation environment.
3. How to use
3.1 Run Nethogs directly to see the current bandwidth-consuming process
3.2 We're going to test the program to find the bandwidth-intensive eth0.
Nethogs Network card Device
We test eth0, run the command.
[Email protected] ~]# nethogs eth0
The first line in the graph is the traffic record in the test, which indicates that the client 192.168.40.250 to access the bandwidth occupied by my 80 port.
In the PID column, you can use the Lsof-p PID to view the process test.
Or use the Lsof-i: port number to see which processes are in use. See 80-Port Lsof-i: 80
Linux View network card traffic for a process or program (GO)