Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

NetHogs real-time monitoring process / program network usage

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

NetHogs is a small open source traffic monitoring tool. Speaking of traffic monitoring tools, there are actually a lot of tools, such as: iftop, vnstat, these are statistics and monitoring of network card traffic. The characteristic of NetHogs is that it can monitor the bandwidth usage of each process in real time. When our server takes up a lot of bandwidth or some other network anomalies, we can use NetHogs to see which process or program exception causes the bandwidth to be occupied, so as to solve the bandwidth problem.

1. NetHogs installation:

1. It is recommended to use installation method:

Install under Ubuntu/Debian:

# apt-get install nethogs

Install under ReadHat/CentOS:

# yum install nethogs

Take centos as an example:

two。 Download the relevant package to compile and install:

Yum-y install gcc-g++ libpcap libpcap-devel

Wget http://jaist.dl.sourceforge.net/project/nethogs/nethogs/0.8/nethogs-0.8.0.tar.gz-p / usr/local/src

Cd / usr/local/src

Tar-xvf nethogs-0.80.tar.gz

Cd nethogs

Make & & make install

2. Use:

Nethogs [- h] [- V] [- d] [- v] [- t] [- c] [- p] [- s] [device (s)]

Examples of specific use:

Use NetHogs directly (the default is to detect the bandwidth of the device eth0, and the default is to refresh every second)

# nethogs

Refresh every 5 seconds using the-d parameter

# nethogs-d 5

Specify the bandwidth of the monitored network card device

# nethogs eth2

# nethogs eth0 eth2

3. Description of specific parameters:

(1) parameters and usage:

-h: displays the usage of available commands

-V: print version information

-d: delayed refresh rate (delayed refresh time), in seconds. Default is one refresh per second.

-v: select view mode

-p: sniffing in mixed mode (not recommended)

-t: tracking mode

-c: limit the number of refreshes (seems to be available only in version 0.8.1-SNAPSHOT and later versions)

-s: sort by the traffic sent (seems to be available only in version 0.8.1-SNAPSHOT and later versions)

Device (s): listening device. Default is eth0 (network card device name).

(2) NetHogs interactive control: (use keystroke operation)

M: press m key to switch units or display occupancy speed; the switching order is (KB/sec,KB,B,MB)

R: press r key to sort by received traffic

S: press the s key to sort by send traffic

Q: press Q key to exit

IV. Extended use of NetHogs

1. Redirect the information output of the nethogs monitoring process to a log file

# nethogs-c 1-t > test.log (does not seem to be supported in version 0.8.0)

Note: if you do not add the-t parameter, the content redirected to the file may be garbled.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report