一个很强大的工具,集top,vmstat,iostat,netstat等功能于一身
yum install dstat
直接使用dstat,默认使用的是-cdngy参数,分别显示cpu、disk、net、page、system信息
详细可选参数(通过dstat --list可以查看dstat能使用的所有参数):
Dstat options:
-c, --cpu enable cpu stats
-C 0,3,total include cpu0, cpu3 and total
-d, --disk enable disk stats
-D total,hda include hda and total
-g, --page enable page stats
-i, --int enable interrupt stats
-I 5,eth2 include int5 and interrupt used by eth2
-l, --load enable load stats
-m, --mem enable memory stats
-n, --net enable network stats
-N eth1,total include eth1 and total
-p, --proc enable process stats
-r, --io enable io stats (I/O requests completed)
-s, --swap enable swap stats
-S swap1,total include swap1 and total
-t, --time enable time/date output
-T, --epoch enable time counter (seconds since epoch)
-y, --sys enable system stats
--aio enable aio stats
--fs, --filesystem enable fs stats
--ipc enable ipc stats
--lock enable lock stats
--raw enable raw stats
--socket enable socket stats
--tcp enable tcp stats
--udp enable udp stats
--unix enable unix stats
--vm enable vm stats
--plugin-name enable plugins by plugin name (see manual)
--list list all available plugins
-a, --all equals -cdngy (default)
-f, --full automatically expand -C, -D, -I, -N and -S lists
-v, --vmstat equals -pmgdsc -D total
--float force float values on screen
--integer force integer values on screen
--bw, --blackonwhite change colors for white background terminal
--nocolor disable colors (implies --noupdate)
--noheaders disable repetitive headers
--noupdate disable intermediate updates
--output file write CSV output to file
例如: dstat -tcdlmnpsy 1 100 前面的是相隔几秒打印1次,后面是一共打印多少次
----system---- ----total-cpu-usage---- -dsk/total- ---load-avg--- ------memory-usage----- -net/total- ---procs--- ----swap--- ---system-- date/time |usr sys idl wai hiq siq| read writ| 1m 5m 15m | used buff cach free| recv send|run blk new| used free| int csw 15-09 17:14:05| 0 1 99 0 0 0| 0 0 | 0 0.02 0|73.0M 20.8M 117M 272M| 150B 714B| 0 0 0| 0 200M| 23 20 15-09 17:14:06| 1 0 99 0 0 0| 0 0 | 0 0.02 0|73.0M 20.8M 117M 272M| 60B 1466B| 0 0 0| 0 200M| 15 12 15-09 17:14:07| 0 0 100 0 0 0| 0 0 | 0 0.02 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 17 12 15-09 17:14:08| 0 0 100 0 0 0| 0 0 | 0 0.02 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 14 12 15-09 17:14:09| 0 1 99 0 0 0| 0 0 | 0 0.02 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 22 18 15-09 17:14:10| 1 0 99 0 0 0| 0 0 | 0 0.02 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 20 12 15-09 17:14:11| 0 0 99 0 0 1| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 22 14 15-09 17:14:12| 0 1 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 20 10 15-09 17:14:13| 1 0 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 660B| 0 0 1.0| 0 200M| 29 29 15-09 17:14:14| 0 1 98 0 0 1| 0 12k| 0 0.01 0|73.0M 20.8M 117M 272M| 120B 596B| 0 0 0| 0 200M| 23 17 15-09 17:14:15| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 18 13 15-09 17:14:16| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 15 12 15-09 17:14:17| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 16 12 15-09 17:14:18| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 15 12 15-09 17:14:19| 1 0 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 17 12 15-09 17:14:20| 0 1 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 1.0| 0 200M| 19 23 15-09 17:14:21| 1 0 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 18 15 15-09 17:14:22| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 14 12 15-09 17:14:23| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 20 14 15-09 17:14:24| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 15 10 15-09 17:14:25| 1 1 98 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 16 12 15-09 17:14:26| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 14 12 15-09 17:14:27| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 19 13 15-09 17:14:28| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 660B| 0 0 0| 0 200M| 17 15 15-09 17:14:29| 1 0 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 18 13 15-09 17:14:30| 0 1 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 19 10 15-09 17:14:31| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 21 14 15-09 17:14:32| 0 0 99 0 0 1| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 18 10 15-09 17:14:33| 1 1 98 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 22 15 15-09 17:14:34| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 17 16 15-09 17:14:35| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 22 15 15-09 17:14:36| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 15 12 15-09 17:14:37| 0 1 99 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 120B 596B| 0 0 0| 0 200M| 18 12 15-09 17:14:38| 0 0 100 0 0 0| 0 0 | 0 0.01 0|73.0M 20.8M 117M 272M| 60B 554B| 0 0 0| 0 200M| 15 12
..
以前一些前辈做的那些统计图,访问量,TPS,QPS 都可以用这玩意做
[root@localhost ~]# dstat -tsp --socket --fs --output /tmp/dstat.csv
这样生成的csv文件可以用excel打开,然后生成图表。
看下当前最消耗IO的进程和最消耗块设备IO的进程可以执行如下命令:
[root@localhost ~]# dstat -t --top-io
.
-
原文:http://my.oschina.net/httpssl/blog/506413