Network traffic monitoring tool under Linux

Source: Internet
Author: User

Today QA classmate asked me to help detect the next server network traffic. Did not do this work, on the Internet casually find a command. Later, the discovery is wrong, in order to not embarrass later, decided to collect network traffic monitoring related tools.

    1. View the total amount of data sent and received by a NIC

Method One

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/4D/DB/wKioL1RbHZCD7s5eAAHC5Sol0EM688.jpg "title=" 111. PNG "alt=" wkiol1rbhzcd7s5eaahc5sol0em688.jpg "/>

Method Two

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4D/DB/wKioL1RbHfGxTLScAAEycpZawfI050.jpg "title=" 111. PNG "alt=" wkiol1rbhfgxtlscaaeycpzawfi050.jpg "/>


2. Check the real-time traffic of the network card

Tool One

A script found on the internet basically deals with the results of ifconfig and gets the traffic per unit of time. You can also get the same result by working with the/proc/net/dev file.

How to use: Bash scriptfile eth1 no parameter defaults to eth0

#!/bin/bashif [ -n  "$"  ]; theneth_name=$1elseeth_name= "eth0" fii=0send_o= ' BusyBox  ifconfig  $eth _name | grep bytes | awk  ' {print $6} '  |  awk -f :  ' {print $2} ' recv_o= ' busybox ifconfig  $eth _name | grep  bytes | awk  ' {print $2} '  | awk -F :  ' {print $2} ' send_n=$ send_orecv_n= $recv _owhile [  $i  -le 100000 ]; dosend_l= $send _nrecv_l= $recv _nsleep  1send_n= ' busybox ifconfig  $eth _name | grep bytes | awk  ' {print  $6} '  | awk -F :  ' {print $2} ' recv_n= ' busybox ifconfig  $eth _name  | grep bytes | awk  ' {print $2} '  | awk -F :  ' { print $2} ' i= ' expr  $i  + 1 ' send_r= ' expr  $send _n -  $send _l ' recv_r= ' expr  $recv _n -  $recv _L ' total_r= ' expr  $send _r +  $recv _r ' send_ra= ' expr \ (  $send _n -  $send _o \ )  /  $i ' recv_ra= ' expr \ (  $recv _n -  $recv _o \)  /  $i ' total_ra= ' expr   $send _ra +  $recv _ra ' sendn= ' busybox ifconfig  $eth _name | grep bytes  | awk -f \ (  ' {print $3} '  | awk -f \)   ' {print $1} ' ' recvn= ' busybox ifconfig  $eth _name | grep bytes | awk -f \ (  ' {print $2} '  | awk -f \   ' {print $1} ' clearecho   ' Last  second  :   send rate:  $send _r bytes/sec  recv rate:   $RECV _r bytes/sec  total rate:  $total _r bytes/sec "echo  " Average  value:   Send rate:  $send _ra bytes/sec  recv rate: $ Recv_ra bytes/sec  total rate:  $total _ra bytes/sec "echo  " total traffic after  startup:    send traffic:  $sendn   Recv traffic:  $recvn "done

Tool Two

Name: Iptraf

Installation: Apt-get-y Install Iptraf

Use: Iptraf or Iptraf-g

Tool Three

Name: Ifstat

Installation: Apt-get-y Install Ifstat

Use: direct command Ifstat

Tool Four

Name: nload

Installation: Apt-get-y Install nload

Use: nload

Tool Five

Name: Iftop

Installation: Apt-get-y Install Iftop

Use: Iftop or Iftop-i eth1

Tool Six

Name: Nethlogs

Installation: Apt-get-y Install Nethlogs

Use: Nethlogs or Nethlogs eth1

Tool Seven

Name: Bmon

Installation: Apt-get-y Install Bmon

Use: Bmon

Tool Eight

Name: Collectl

Installation: Apt-get-y Install Collectl

Use: collectl-sn-ot-i0.5

Tool Nine

Name: Dstat

Installation: Pip Install Dstat

Use: Dstat-nt

Tool 10
Name: Netload

Installation: Apt-get-y Install Netdiag

Use: Netload eth0

Tool 11

Name: Trafshow

Installation: Apt-get-y Install Netdiag

Use: Trafshow-i eth0

Tool 12

Name: Speedmeter

Installation: Apt-get-y Install Speedmeter

Use: Speedometer-r eth1-t eth1

Tool 13

Name: Slurm

Installation: Apt-get-y Install Slurm

Use: slurm-s-i eth1

Tool 14

Name: Tcptrack

Installation: Apt-get Install Tcptrack

Use: Tcptrack-i eth1

Tool 15

Name: Vnstat

Installation: Apt-get-y Install Vnstat

Use: Vnstat

Tool 16

Name: Bwm-ng

Installation: Apt-get-y Install Bwm-ng

Use: Bwm-ng

Tool 17

Name: CBM

Installation: Apt-get-y Install CBM

Use: CBM

Tool 18

Name: Pkstat

Installation: Apt-get-y Install Pkstat

Use: Pkstat-i eth0-nt

Tool 19

Name: Netwatch

Installation: Apt-get-y Install Netdiag

Use: Netwatch-e eth1-nt

Tool 20

Name: SAR

Installation: Apt-get-y Install SAR

Use: Sar-n DEV 1 4


There are a lot of tools to view network traffic, most of them are similar, choose one or two of their favorite use is OK


Reference Address:

Http://os.chinaunix.net/a2010/0105/1000/000001000027.shtml

http://blog.csdn.net/0210/article/details/5437368

http://www.binarytides.com/linux-commands-monitor-network/

This article is from the "Small City Ops" blog, please be sure to keep this source http://lixcto.blog.51cto.com/4834175/1574073

Network traffic monitoring tool under Linux

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.