iftop和iostat安装和简单使用

来源:互联网 发布:几比几的比例怎么算法 编辑:程序博客网 时间:2024/05/20 19:47

1、安装

安装依赖包,yum install flex byacc  libpcap ncurses ncurses-devel libpcap-devel

上传到linux安装包,可以使用crt中的put命令上传,解压可能需要用到unzip、tar命令,其中解压gz2参数是jxvf,gz的是zxvf

安装,先编译,在解压的目录下执行:./configure 然后make && make install

2、使用

其中iftop

iftop: display bandwidth usage on an interface by host

Synopsis: iftop -h | [-npbBP] [-i interface] [-f filter code] [-N net/mask]

   -h                  display this message
   -n                  don't do hostname lookups
   -N                  don't convert port numbers to services
   -p                  run in promiscuous mode (show traffic between other
                       hosts on the same network segment)
   -b                  don't display a bar graph of traffic
   -B                  Display bandwidth in bytes
   -i interface        listen on named interface
   -f filter code      use filter code to select packets to count
                       (default: none, but only IP packets are counted)
   -F net/mask         show traffic flows in/out of network
   -P                  show ports as well as hosts
   -m limit            sets the upper limit for the bandwidth scale
   -c config file      specifies an alternative configuration file
sar的帮助

Usage: sar [ options... ] [ <interval> [ <count> ] ]
Options are:
[ -A ] [ -b ] [ -B ] [ -c ] [ -d ] [ -i <interval> ] [ -p ] [ -q ]
[ -r ] [ -R ] [ -t ] [ -u ] [ -v ] [ -V ] [ -w ] [ -W ] [ -y ]
[ -I { <irq> | SUM | ALL | XALL } ] [ -P { <cpu> | ALL } ]
[ -n { DEV | EDEV | NFS | NFSD | SOCK | ALL } ]
[ -x { <pid> | SELF | ALL } ] [ -X { <pid> | SELF | ALL } ]
[ -o [ <filename> ] | -f [ <filename> ] ]
[ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]

 

比如要查看一个文件读写5次间隔2秒,cpu使用情况

sar -u -o filename  2  5

 

查看内存sar -r 2 5

查看网络 sar -n DEV 2 5

 

0 0
原创粉丝点击