In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what are the necessary commands for network bandwidth monitoring for linux operation and maintenance engineers. I hope you will gain something after reading this article. Let's discuss it together.
Some commands can display the bandwidth used by a single process. In this way, it is easy for users to find a process that is overusing network bandwidth.
These tools use different mechanisms to produce traffic reports. Some tools, such as nload, can read the "proc/net/dev" file for traffic statistics, while others use the pcap library to capture all packets and then calculate the total amount of data to estimate the traffic load.
The following is the command name by function.
Monitor overall bandwidth usage-nload, bmon, slurm, bwm-ng, cbm, speedometer and netload
Monitor overall bandwidth usage (batch output)-vnstat, ifstat, dstat and collectl
Bandwidth usage per socket connection-iftop, iptraf, tcptrack, pktstat, netwatch and trafshow
Bandwidth usage per process-- nethogs
1. Nload
Nload is a command-line tool that allows users to monitor inbound and outbound traffic separately. It can also draw charts to show inbound and outbound traffic, and the view scale can be adjusted. It is easy to use and does not support many options.
So, if you only need to quickly check the total bandwidth usage without the details of each process, then nload is very convenient to use.
$nload
Installing nload:Fedora and Ubuntu has nload in the default software library. CentOS users need to obtain nload from the Epel software library.
# fedora or centos $yum install nload-y # ubuntu/debian $sudo apt-get install nload
2. Iftop
Iftop measures the data transmitted over each socket connection; it works differently from nload. Iftop uses the pcap library to capture packets going in and out of the network adapter, and then summarizes the packet size and number to figure out the overall bandwidth usage.
Although iftop reports the bandwidth used by each connection, it cannot report the name / number of processes participating in a socket connection (ID). However, because it is based on the pcap library, iftop can filter traffic and report the bandwidth usage of selected host connections specified by the filter.
$sudo iftop-n
The n option prevents iftop from parsing IP addresses into hostnames, which itself generates additional network traffic.
Users who install iftop:Ubuntu/Debian/Fedora can obtain it from the default software library. CentOS users can get it from Epel.
# fedora or centos yum install iftop-y # ubuntu or debian $sudo apt-get install iftop
3. Iptraf
Iptraf is an interactive and colorful IP LAN monitoring tool. It can display the amount of data transferred between each connection and between hosts. Here is a screenshot.
$sudo iptraf
Install iptraf:
# Centos (basic software library) $yum install iptraf # fedora or centos (with epel) $yum install iptraf-ng-y # ubuntu or debian $sudo apt-get install iptraf iptraf-ng
4. Nethogs
Nethogs is a small "net top" tool that displays the bandwidth used by each process and sorts the list, ranking the processes that consume the most bandwidth at the top. In case of a sudden surge in bandwidth usage, users can quickly turn on nethogs and find the process that caused the surge in bandwidth usage. Nethogs can report the process number (PID), user, and path of the program.
$sudo nethogs
Users who install nethogs:Ubuntu, Debian, and Fedora are available from the default software library. CentOS users need Epel.
# ubuntu or debian (default software library) $sudo apt-get install nethogs # fedora or centos (from epel) $sudo yum install nethogs-y
5. Bmon
Bmon (bandwidth Monitor) is a nload-like tool that displays the traffic load of all network interfaces on the system. The output also contains charts and profiles, with details at the packet level.
Install bmon:Ubuntu, Debian, and Fedora users can install from the default software library. CentOS users need to install repoforge because there is no bmon in Epel.
# ubuntu or debian $sudo apt-get install bmon # fedora or centos (from repoforge) $sudo yum install bmon
Bmon supports many options for producing reports in HTML format. For more information, see the reference manual page.
6. Slurm
Slurm is another network load monitor that can display device statistics and ASCII graphics. It supports three different types of graphics, each of which can be activated by using the c, s, and l keys. Slurm is simple and cannot display any further details about the network load.
$slurm-s-I eth0
Install slurm
# debian or ubuntu $sudo apt-get install slurm # fedora or centos $sudo yum install slurm-y
7. Tcptrack
Tcptrack, similar to iftop, uses the pcap library to capture packets and calculate various statistics, such as the bandwidth used for each connection. It also supports standard pcap filters that can be used to monitor specific connections.
Installing tcptrack:Ubuntu, Debian, and Fedora has it in the default software library. CentOS users need to get it from RepoForge because it is not in Epel.
# ubuntu, debian $sudo apt-get install tcptrack # fedora, centos (from repoforge software library) $sudo yum install tcptrack
8. Vnstat
Vnstat is a little different from most other tools. It actually runs the background service / daemon, constantly recording the size of the data transferred. In addition, it can be used to produce reports showing the history of network usage.
$service vnstat status * vnStat daemon is running
Running vnstat with no options only shows the total amount of data transferred since the daemon ran.
$vnstat Database updated: Mon Mar 17 15:26:59 2014 eth0 since 06 GiB total 12 rx: 135.14 GiB tx: 35.76 GiB total: 170.90 GiB monthly rx | tx | total | avg. Rate-+-Feb '148.19 GiB | 2.08 GiB | 10.27 GiB | 35.60 kbit/s Mar' 144.98 GiB | 1.52 GiB | 6.50 GiB | 37.93 kbit/s-- -- +-estimated 9.28 GiB | 2.83 GiB | 12.11 GiB | daily rx | tx | total | avg. Rate-+-yesterday 236.11 MiB | 98.61 MiB | 334.72 MiB | 31.74 kbit/s today 128.55 MiB | 41.00 MiB | 169.56 MiB | 24.97 kbit/s- -+-estimated 199 MiB | 63 MiB | 262MiB |
To monitor bandwidth usage in real time, use the "- l" option (real-time mode). It then displays the total amount of bandwidth used by the inbound and outbound data, but very accurately, without any internal details about the host connection or process.
$vnstat-l-I eth0 Monitoring eth0... (press CTRL-C to stop) rx: 12 kbit/s 10 pacers tx: 12 kbit/s 11 pcanes
Vnstat is more like a tool for producing historical reports, showing how much bandwidth has been used each day or in the past month. It is not a strict tool for real-time monitoring of the network.
Vnstat supports many options, and see the reference manual page for details on which options are supported.
Install vnstat
# ubuntu or debian $sudo apt-get install vnstat # fedora or centos (from epel) $sudo yum install vnstat
9. Bwm-ng
Bwm-ng (next Generation bandwidth Monitor) is another very simple real-time network load monitoring tool that reports summary information and shows the speed of different data going in and out of all available network interfaces on the system.
$bwm-ng bwm-ng v0.6 (probing every 0.500s) Press 'h' for help input: / proc/net/dev type: rate / iface Rx Tx T ot= eth0: 0.53 KB/s 1.31 KB/s 1.84 KB lo: 0.00 KB/s 0.00 KB/s 0.00 KB -total: .53 KB/s 1.31 KB/s 1.84 KB/s
If the console is large enough, bwm-ng can also use the curses2 output mode to draw a bar chart for traffic.
$bwm-ng-o curses2
Install bwm-ng: on CentOS, you can install bwm-ng from Epel.
# ubuntu or debian $sudo apt-get install bwm-ng # fedora or centos (from epel) $sudo apt-get install bwm-ng
10. Cbm:Color Bandwidth Meter
This is a small and simple bandwidth monitoring tool that can display the amount of traffic passing through various network interfaces. There is no further option, just to display and update traffic statistics in real time.
$sudo apt-get install cbm
11. Speedometer
This is another small and simple tool that only draws good-looking graphics to show inbound and outbound traffic transmitted through an interface.
$speedometer-r eth0-t eth0
Install speedometer
# ubuntu or debian user $sudo apt-get install speedometer
12. Pktstat
Pktstat can display all active connections in real time and show the speed at which data is transmitted through these active connections. It can also show the connection type, such as a TCP connection or a UDP connection, and, if a HTTP connection is involved, detailed information about the HTTP request.
$sudo pktstat-I eth0-nt $sudo apt-get install pktstat
13. Netwatch
Netwatch, which is part of the netdiag toollibrary, can also display connections between local hosts and other remote hosts, and show which data is transferred at a speed on each connection.
$sudo netwatch-e eth0-nt $sudo apt-get install netdiag
14. Trafshow
Like netwatch and pktstat, trafshow can report on currently active connections, the protocols they use, and the data transfer speed on each connection. It can filter connections using pcap type filters.
Monitor only TCP connections
$sudo trafshow-I eth0 tcp $sudo apt-get install netdiag
15. Netload
The netload command displays only a short report on the current traffic load and the total number of bytes transferred since the program started. There are no more features. It is part of netdiag.
$netload eth0 $sudo apt-get install netdiag
16. Ifstat
Ifstat can display network bandwidth in batch mode. The output is in a format that makes it easy for users to log and analyze using other programs or utilities.
$ifstat-t-I eth0 0.5 Time eth0 HH:MM:SS KB/s in KB/s out 09:59:21 2.62 2.80 09:59:22 2.10 1.78 09:59:22 2.67 1.84 09:59:23 2.06 1.98 09:59:23 1.73 1.79
Users who install ifstat:Ubuntu, Debian, and Fedora have it in the default software library. CentOS users need to get it from Repoforge because it is not in Epel.
# ubuntu, debian $sudo apt-get install ifstat # fedora, centos (Repoforge) $sudo yum install ifstat
17. Dstat
Dstat is a versatile tool (written in Python) that can monitor different statistics of the system and report using batch mode, or record the relevant data in CSV or similar files. This example shows how to use dstat to report network bandwidth.
Install dstat
$dstat-nt-net/total- system---- recv send | time 0 0 | 23-03 10:27:13 1738B 1810B | 23-03 10:27:14 2937B 2610B | 23-03 10:27:15 2319B 2232B | 23-03 10:27:16 2738B 2508B | 23-03 10:27:17
18. Collectl
Collectl reports system statistics in a format similar to dstat; like dstat, it collects statistics about different resources of the system, such as processors, memory, networks, and so on. Here is a simple example of how to use collectl to report network usage / bandwidth.
$collectl-sn-oT-i0.5 waiting for 0.5 second sample... # # Time KBIn PktIn KBOut PktOut 10:32:01 40 58 43 66 10:32:01 27 58 3 32 10:32:02 3 28 9 44 10:32:02 5 42 96 96 10:32:03 5 48 3 28
Install collectl
# Ubuntu/Debian user $sudo apt-get install collectl # Fedora $sudo yum install collectl after reading this article, I believe you have a certain understanding of "what are the common commands for network bandwidth monitoring necessary for linux operation and maintenance engineers". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.