This guide is based on a CentOS cloud server and introduces the installation and usage of Nethogs, a network monitoring tool. System administrators can use Nethogs to quickly identify processes causing performance degradation on the server. Unlike other similar tools, Nethogs sorts the bandwidth consumption by each process, rather than by protocol or subnet, enabling network administrators to swiftly pinpoint the causes of sudden bandwidth spikes on the server.
The Nethogs package is available through the EPEL third-party software repository, thus requiring the installation of EPEL prior to installing Nethogs.
sudo yum -y install epel-release
sudo yum -y update
sudo yum -y install nethogs
Launching Nethogs requires just a single command line, which automatically starts monitoring the default network interface's traffic.
sudo nethogs
Nethogs can also monitor multiple network interfaces simultaneously, such as eth0 and eth1.
sudo nethogs eth0 eth1
On the Nethogs display screen, press the 'm' key to toggle between total traffic and real-time bandwidth display. Press the 'q' key to exit the display.
Set the refresh interval to 3 seconds, with the default being 1 second.
sudo nethogs -d 3
Display the version number of Nethogs.
nethogs -V
Display the help information for Nethogs.
nethogs -h
23-02-2024 02:02:07
22-02-2024 03:19:32
22-02-2024 03:16:03
22-02-2024 03:14:03
22-02-2024 03:11:58