命令拷屏之流量监视

iptraf        好用                                                                            yum install iptraf
iptraf  is an ncurses-based IP LAN monitor that generates various network statistics including TCP info, UDP counts, ICMP and OSPF information, Ethernet,load info, node stats, IP checksum errors, and others.If the command is issued without any command-line options, the program comes up in interactive mode, with the various facilities  accessed  through  the main menu.

ipband

nethogs
安装nethogs
yum -y install nethogs
(1)、可以实时查看系统当前进程的流量
(2)、可以和nload结合起来,可以诊断出很多问题。
如果要将这些数据记录到日志里,可以使用下面的命令:
nethogs -b | tee log.txt


nload        不自带    简单直观
wget http://www.roland-riegel.de/nload/nload-0.7.2.tar.gz
tar zxvf nload-0.7.2.tar.gz
cd nload-0.7.2
./configure;make;make install
使用
直接用nload回车即可,也可以指定网卡,如nload eth1
还可以指定是以K或M来显示流量,如nload -u M显示的流量是以MB为单位的
看看还有哪些参数或选项
[root@wdlinux ~]# nload -u K
[root@wdlinux ~]# nload -h

ifstat        不自带    简单直观
Ifstat is a little tool to report interface activity, just like iostat/vmstat do for other system statistics.
ifstat gathers these statistics from the kernel internal counters, which is highly operating system dependent.Right now, the following systems are supported:
    Linux >= 2.2.0 (through /proc/net/dev file).
    FreeBSD >= 2.2 (using the ifmib(4) interface).
    Solaris >= 5.6 (using the kstat(3K) interface).
    IRIX and OpenBSD (using the SIOCGIFDATA ioctl).
    NetBSD and Darwin (using the route(4) sysctl interface).
    Other BSDs (using the kvm(3) interface).
    Digital Unix (OSF/1), Tru64, and Aix (using the legacy kmem interface).
    HP-UX (using the DPLI streams interface).
    Win32 native or through Cygwin (using the GetIfTable call).
wget -S http://gael.roualland.free.fr/ifstat/ifstat-1.1.tar.gz
tar zxvf ifstat-1.1.tar.gz
cd ifstat-1.1
./configure
make;make install
ifstat


iftop        不自带

安装库文件,需要 libpcap 及 libcurses 。
yum install -y flex byacc libpcap ncurses ncurses-devel libpcap-devel

wget -S http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17                                                                        

./configure                                                                            make;make install
使用
iftop -i eth1 -B
iftop -i eth2 -B -m 30M
iftop -n -i eth1

iftop -i eth0 -n -P  显示端口号
http://jiajun.iteye.com/blog/419515

watch ifconfig
watch more /proc/net/dev
watch -n 1 "/sbin/ifconfig eth0 | grep bytes"
ulimit -n

[root@CactiEZ ~]# netstat -s
[root@CactiEZ ~]# sar -n DEV 1
[root@CactiEZ ~]# sar -n EDEV 1 2
-n参数很有用,他有6个不同的开关:DEV | EDEV | NFS | NFSD | SOCK | ALL 。
DEV显示网络接口信息,EDEV显示关于网络错误的统计数据,NFS统计活动的NFS客户端的信息,NFSD统计NFS服务器的信息,SOCK显示套接字信息,ALL显示所有5个开关。它们可以单独或者一起使用。
rxerr/s:每秒钟接收的坏数据包 txerr/s:每秒钟发送的坏数据包 coll/s:每秒冲突数
rxdrop/s:因为缓冲充满,每秒钟丢弃的已接收数据包数
txdrop/s:因为缓冲充满,每秒钟丢弃的已发送数据包数
txcarr/s:发送数据包时,每秒载波错误数
rxfram/s:每秒接收数据包的帧对齐错误数
rxfifo/s:接收的数据包每秒FIFO过速的错误数
txfifo/s:发送的数据包每秒FIFO过速的错误数

原文地址:https://www.cnblogs.com/createyuan/p/3636169.html