Three methods of Linux traffic monitoring

Source: Internet
Author: User

Because linux traffic monitoring is often performed for Linux, the above three methods can be used to determine the future traffic. note: People think that nload is very powerful and not accurate. device method, please check another white chapter, linux rpm higher governance.


Linux traffic monitoring iftop Tool
Usage: It is used to immediately monitor network channels.
Fulfill (must be root)
Monitor the network card quality of eth1
# Iftop-I eth1
Display traffic with double bits (default non-bits) as the bitkey (bytes ):
$ Iftop-B
The IP address is indirectly displayed, and the DNS system is not entered and ended:
$ Iftop-n
The serial number is indirectly displayed, and no implicit service title is displayed:
$ Iftop-N
Indicates the quality of an enabled packet for an inbound/outbound network segment.
$ Iftop-F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
For other parameters, see iftop-h.
When you enter the iftop image, Do you want to press p to switch non-printable ports? n to switch the hidden IP address or the domain name, ghd MK4 IV Pure of the slave machine, N switch display port code or title, p long stop display, B switch can display a few, B switch to calculate a few seconds out of the uniform streaming, other buttons can follow the h wait and see to clarify.


Linux traffic monitoring nload
Usage: It is used to immediately monitor network channels. The application frequency of each ip address is very wide (it is empty talk)
Nload acquiesce to the eth0 Nic. If you want to monitor the traffic of the eth1 Nic
# Nload eth1
The nload default combination is high and low: the lower half of the door is: Incoming also does not enter the network card traffic, the upper half is: Outgoing, that is, the Incoming traffic from the network card, no subsequent traffic for each part (Curr), Avg for all traffic in the region, Min for the maximum traffic, Max for the minimum traffic), and Ttl for combat traffic, it's still a pretty song.
In addition, you can also define the double bits for the traffic value.
# Nload -- help
Then you can see the detailed coherent parameters.
Check for even network traffic
The above does not properly monitor the even traffic of your network, and you can downgrade the subscription time.
 

 
 
  1. #!/bin/bash   
  2. echo -n "which nic?"   
  3. read eth   
  4. echo "the nic is "$eth   
  5. echo -n "how much seconds:"   
  6. read sec   
  7. echo "duration is "$sec" seconds, wait please..."   
  8. infirst=$(awk '/'$eth'/{print $1 }' /proc/net/dev |sed 's/'$eth'://')   
  9. outfirst=$(awk '/'$eth'/{print $10 }' /proc/net/dev)   
  10. sumfirst=$(($infirst+$outfirst))   
  11. sleep $sec"s"   
  12. inend=$(awk '/'$eth'/{print $1 }' /proc/net/dev |sed 's/'$eth'://')   
  13. outend=$(awk '/'$eth'/{print $10 }' /proc/net/dev)   
  14. sumend=$(($inend+$outend))   
  15. sum=$(($sumend-$sumfirst))   
  16. echo $sec" seconds total :"$sum"bytes"   
  17. aver=$(($sum/$sec))   
  18. echo "avrage :"$aver"bytes/sec"  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.