Article Title: Linux graphic traffic monitoring and I/O monitoring. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Iftop Tool
Purpose: monitors the network status and bandwidth used by each ip address in real time.
Run the command (must be root)
Monitor network card Traffic of eth1
# Iftop-I eth1
Traffic is displayed in bytes (by default, bits ):
$ Iftop-B
The IP address is displayed directly without reverse DNS resolution:
$ Iftop-n
The connection port number is displayed directly, but the service name is not displayed:
$ Iftop-N
Display inbound and outbound traffic of a CIDR Block
$ 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 screen, you can press p to switch whether to display the connection port, n to switch to display the IP address or the domain name of the host, N to switch to display the connection port code or name, and p to suspend display, switch B to check whether the display bar is displayed. Switch B to calculate the average traffic in a few seconds. Other buttons can be clicked h to view the description.
Set the file location ~ /. Iftoprc. For details about how to set the file, refer to the info page of iftop.
Nload
Purpose: monitors the network status and bandwidth used by each ip address in real time (nonsense)
The default nload is the eth0 Nic. If you want to monitor the traffic of the eth1 Nic
# Nload eth1
By default, nload is divided into two parts: the upper part is: Incoming, that is, the traffic into the NIC, the lower part is: Outgoing, that is, the traffic from this Nic, each part includes the current traffic (Curr), average traffic (Avg), minimum traffic (Min), maximum traffic (Max), and total traffic (Ttl, it looks quite intuitive.
In addition, you can also define the unit of Traffic Value display.
# Nload? Help
You can see the specific parameters.
View average network traffic
The following script can monitor the average traffic of your network. You can set the time.
#! /Bin/bash
Echo-n "which nic ?"
Read eth
Echo "the nic is" $ eth
Echo-n "how much seconds :"
Read sec
Echo "duration is" $ sec "seconds, wait please ..."
Infirst = $ (awk '/' $ eth '/{print $1}'/proc/net/dev | sed's/'$ eth '://')
Outfirst = $ (awk '/' $ eth '/{print $10}'/proc/net/dev)
Sumfirst = $ ($ infirst + $ outfirst ))
Sleep $ sec "s"
Inend = $ (awk '/' $ eth '/{print $1}'/proc/net/dev | sed's/'$ eth '://')
Outend = $ (awk '/' $ eth '/{print $10}'/proc/net/dev)
Sumend = $ ($ inend + $ outend ))
Sum = $ ($ sumend-$ sumfirst ))
Echo $ sec "seconds total:" $ sum "bytes"
Aver = $ ($ sum/$ sec ))
Echo "avrage:" $ aver "bytes/sec"
There is also a software called ipband to listen well, interested can go to the http://ipband.sourceforge.net/look
I/O graphical monitoring
Windows job manager is good. You can see the process and the corresponding I/O. It is also available in linux, but python> = 2.5, kernel>; = 2.6.20