在微博上发现一个很好的监控工具dstat,并且是彩色显示的,各类状况一目了然,很方便。bash
wget http://dag.wieers.com/rpm/packages/dstat/dstat-0.6.7-1.rh7.rf.noarch.rpm rpm -ivh dstat-0.6.7-1.rh7.rf.noarch.rpm
安装完成后,执行 dstat 命令,默认状况它会收集 cpu、disk、net、paging、system 数据,一秒钟收集一次
惟一缺点是dstat只能显示磁盘的吞吐量而不能显示负载状况,只能对整个系统进行监控而不能对某一个进程或某一个程序进行深刻分析。
使用网络
#最经常使用的参数是: dstat -cdlmnpsy#若是你想5秒收集一次,就 dstat -cdlmnpsy5
dstat的一些参数:tcp
Dstat options: -c, --cpu 显示CPU状况 -C0,3,total include cpu0, cpu3 and total -d, --disk 显示磁盘状况 -D total,hda include hda and total -g, --pageenable page stats -i, --intenable interrupt stats -I5,eth2 include int5 and interrupt used by eth2 -l, --loadenable load stats -m, --mem 显示内存状况 -n, --net 显示网络状况 -N eth1,total 能够指定网络接口 -p, --procenable process stats -s, --swap 显示swap状况 -S swap1,total 能够指定多个swap -t, --timeenabletime counter -y, --sysenable system stats --ipc 报告IPC消息队列和信号量的使用状况 --lockenable lock stats --rawenable raw stats --tcpenable tcp stats --udpenable udp stats --unixenable unix stats -M stat1,stat2 enable external stats --mods stat1,stat2 -a, --all 使用-cdngy 缺省的就是这样显示 -f, --full 使用 -C, -D, -I, -N and -S 显示 -v, --vmstat 使用-pmgdsc -D 显示 --integer show integer values --nocolor disable colors (implies --noupdate)--noheaders 只显示一次表头之后就不显示了,使用重定向写入文件时颇有用 --noupdate disable intermediate updates --outputfile 写入到CVS文件中