{"id":312,"date":"2012-01-05T14:04:02","date_gmt":"2012-01-05T06:04:02","guid":{"rendered":"http:\/\/www.kiccleaf.com\/?p=312"},"modified":"2012-01-05T20:57:44","modified_gmt":"2012-01-05T12:57:44","slug":"%e9%87%87%e7%94%a8linux%e6%80%a7%e8%83%bd%e7%9b%91%e6%b5%8b%e5%b7%a5%e5%85%b7dstat%e6%9d%a5%e5%88%86%e6%9e%90%e7%b3%bb%e7%bb%9f%e8%b5%84%e6%ba%90%e6%83%85%e5%86%b5","status":"publish","type":"post","link":"http:\/\/www.kiccleaf.com\/?p=312","title":{"rendered":"\u91c7\u7528Linux\u6027\u80fd\u76d1\u6d4b\u5de5\u5177dstat\u6765\u5206\u6790\u7cfb\u7edf\u8d44\u6e90\u60c5\u51b5"},"content":{"rendered":"<p>\u65e5\u5e38\u7ba1\u7406\u4e2d\u4f7f\u7528\u9700\u8981\u7ecf\u5e38\u67e5\u770b\u670d\u52a1\u5668\u72b6\u6001\u548c\u6027\u80fd\uff0c\u6bd4\u5982IO\u5360\u7528\u60c5\u51b5\uff0c\u53ca\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u786c\u76d8\uff0cCPU\u7b49\u7b49\u3002\u7f51\u7edc\u4e0a\u641c\u7f57\u4e86\u4e00\u4e0b\uff0c\u8fd9\u4e2adstat\u8f6f\u4ef6\u8fd8\u662f\u6bd4\u8f83\u4e0d\u9519\u80fd\u6ee1\u8db3\u65e5\u5e38\u5206\u6790\u3002\u672c\u4eba\u91c7\u7528\u7684\u662fX64\u7cfb\u7edf\uff0c\u5728CentOS6.2\u7cfb\u7edf\u4e0b\u91c7\u7528yum\u8fdb\u884c\u5b89\u88c5dstat\u8f6f\u4ef6<br \/>\n\u9ed8\u8ba4\u60c5\u51b5\u5b83\u4f1a\u6536\u96c6 cpu\u3001disk\u3001net\u3001paging\u3001system \u6570\u636e\uff0c\u4e00\u79d2\u949f\u6536\u96c6\u4e00\u6b21<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# dstat  #\u8fd0\u884c\u547d\u4ee4\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\r\n-bash: dstat: command not found   #\u6ca1\u6709\u627e\u5230\u6b64\u547d\u4ee4\r\n&#x5B;root@kiccleaf ~]# yum install dstat   #\u8fdb\u884c\u5b89\u88c5\r\nLoaded plugins: fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * base: mirrors.163.com\r\n * extras: mirrors.163.com\r\n * updates: mirrors.163.com\r\nbase                                            | 3.7 kB     00:00     \r\nextras                                          | 3.5 kB     00:00     \r\nupdates                                         | 3.5 kB     00:00     \r\nupdates\/primary_db                              | 654 kB     00:02     \r\nSetting up Install Process\r\nResolving Dependencies\r\n--&gt; Running transaction check\r\n---&gt; Package dstat.noarch 0:0.7.0-1.el6 will be installed\r\n--&gt; Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n=======================================================================\r\n Package       Arch           Version               Repository    Size\r\n=======================================================================\r\nInstalling:\r\n dstat         noarch         0.7.0-1.el6           base         144 k\r\n\r\nTransaction Summary\r\n=======================================================================\r\nInstall       1 Package(s)\r\n\r\nTotal download size: 144 k\r\nInstalled size: 660 k\r\nIs this ok &#x5B;y\/N]: y  #\u8f93\u5165y\u8fdb\u884c\u5b89\u88c5\r\nDownloading Packages:\r\ndstat-0.7.0-1.el6.noarch.rpm                    | 144 kB     00:01     \r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Installing : dstat-0.7.0-1.el6.noarch                            1\/1 \r\n\r\nInstalled:\r\n  dstat.noarch 0:0.7.0-1.el6                                           \r\n\r\nComplete!\r\n&#x5B;root@kiccleaf ~]# dstat -d   #\u67e5\u770b\u786c\u76d8IO\u64cd\u4f5c\r\n-dsk\/total-\r\n read  writ\r\n 861k   90k\r\n   0     0 \r\n   0    68k\r\n4096B 1216k\r\n   0   112k\r\n&#x5B;root@kiccleaf ~]# dstat -h   #\u67e5\u770b\u5e2e\u52a9\u6587\u6863\r\nUsage: dstat &#x5B;-afv] &#x5B;options..] &#x5B;delay &#x5B;count]]\r\nVersatile tool for generating system resource statistics\r\n\r\nDstat options:\r\n  -c, --cpu              enable cpu stats \u663e\u793aCPU\u60c5\u51b5\r\n     -C 0,3,total           include cpu0, cpu3 and total\r\n  -d, --disk             enable disk stats \u663e\u793a\u78c1\u76d8\u60c5\u51b5\r\n     -D total,hda           include hda and total\r\n  -g, --page             enable page stats\r\n  -i, --int              enable interrupt stats\r\n     -I 5,eth2              include int5 and interrupt used by eth2\r\n  -l, --load             enable load stats\r\n  -m, --mem              enable memory stats \u663e\u793a\u5185\u5b58\u60c5\u51b5\r\n  -n, --net              enable network stats \u663e\u793a\u7f51\u7edc\u60c5\u51b5\r\n     -N eth1,total          include eth1 and total \u53ef\u4ee5\u6307\u5b9a\u7f51\u7edc\u63a5\u53e3\r\n  -p, --proc             enable process stats\r\n  -r, --io               enable io stats (I\/O requests completed)\r\n  -s, --swap             enable swap stats \u663e\u793aswap\u60c5\u51b5\r\n     -S swap1,total         include swap1 and total \u53ef\u4ee5\u6307\u5b9a\u591a\u4e2aswap\r\n  -t, --time             enable time\/date output\r\n  -T, --epoch            enable time counter (seconds since epoch)\r\n  -y, --sys              enable system stats\r\n\r\n  --aio                  enable aio stats\r\n  --fs, --filesystem     enable fs stats\r\n  --ipc                  enable ipc stats \u62a5\u544aIPC\u6d88\u606f\u961f\u5217\u548c\u4fe1\u53f7\u91cf\u7684\u4f7f\u7528\u60c5\u51b5\r\n  --lock                 enable lock stats\r\n  --raw                  enable raw stats\r\n  --socket               enable socket stats\r\n  --tcp                  enable tcp stats\r\n  --udp                  enable udp stats\r\n  --unix                 enable unix stats\r\n  --vm                   enable vm stats\r\n\r\n  --plugin-name          enable plugins by plugin name (see manual)\r\n  --list                 list all available plugins\r\n\r\n  -a, --all              equals -cdngy (default) \u4f7f\u7528-cdngy \u7f3a\u7701\u7684\u5c31\u662f\u8fd9\u6837\u663e\u793a\r\n  -f, --full             automatically expand -C, -D, -I, -N and -S lists \u4f7f\u7528 -C, -D, -I, -N and -S \u663e\u793a\r\n  -v, --vmstat           equals -pmgdsc -D total \u4f7f\u7528-pmgdsc -D \u663e\u793a\r\n\r\n  --bw, --blackonwhite   change colors for white background terminal\r\n  --float                force float values on screen\r\n  --integer              force integer values on screen\r\n  --nocolor              disable colors (implies --noupdate)\r\n  --noheaders            disable repetitive headers \u53ea\u663e\u793a\u4e00\u6b21\u8868\u5934\u4ee5\u540e\u5c31\u4e0d\u663e\u793a\u4e86,\u4f7f\u7528\u91cd\u5b9a\u5411\u5199\u5165\u6587\u4ef6\u65f6\u5f88\u6709\u7528\r\n  --noupdate             disable intermediate updates\r\n  --output file          write CSV output to file\r\n\r\ndelay is the delay in seconds between each update (default: 1)\r\ncount is the number of updates to display before exiting (default: unlimited)\r\n\r\n<\/pre>\n<p>\u8f83\u4e3a\u957f\u7528\u7684\u547d\u4ee4\uff0c\u6765\u89c2\u5bdf\u7cfb\u7edf\u8fd0\u884c\u60c5\u51b5<br \/>\n#\u5982\u679c\u4f60\u60f310\u79d2\u6536\u96c6\u4e00\u6b21\uff0c\u5c31\u8f93\u5165\uff1a dstat -cdlmnpsy 10<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# dstat -cdlmnpsy\r\n----total-cpu-usage---- -dsk\/total- ---load-avg--- ------memory-usage----- -net\/total- ---procs--- ----swap--- ---system--\r\nusr sys idl wai hiq siq| read  writ| 1m   5m  15m | used  buff  cach  free| recv  send|run blk new| used  free| int   csw \r\n  0   0  99   0   0   0| 104k   14k|   0    0    0|66.9M 8332k 81.5M  837M|   0     0 |  0   0 1.3|   0  2016M|  65    44 \r\n  0   0 100   0   0   0|   0     0 |   0    0    0|66.9M 8332k 81.5M  837M|  60B 1354B|  0   0   0|   0  2016M|  28    17 \r\n  0   0 100   0   0   0|   0     0 |   0    0    0|66.9M 8332k 81.5M  837M|  60B  522B|  0   0   0|   0  2016M|  24    17 \r\n  0   0 100   0   0   0|   0     0 |   0    0    0|66.9M 8332k 81.5M  837M|  60B  522B|  0   0   0|   0  2016M|  27    18 \r\n  0   0 100   0   0   0|   0     0 |   0    0    0|66.9M 8332k 81.5M  837M| 552B  522B|  0   0   0|   0  2016M|  28    23 \r\n  0   0 100   0   0   0|   0     0 |   0    0    0|66.9M 8332k 81.5M  837M|  60B  522B|  0   0   0|   0  2016M|  26    17 \r\n  0   0 100   0   0   0|   0     0 |   0    0    0|66.9M 8332k 81.5M  837M| 491B  522B|  0   0   0|   0  2016M|  31    17\r\n\r\n<\/pre>\n<p>  \u7edf\u8ba1CPU,IO ,network,system load<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# dstat -cndymlp -N total -D total 5 25\r\n----total-cpu-usage---- -net\/total- -dsk\/total- ---system-- ------memory-usage----- ---load-avg--- ---procs---\r\nusr sys idl wai hiq siq| recv  send| read  writ| int   csw | used  buff  cach  free| 1m   5m  15m |run blk new\r\n  0   0  99   0   0   0|   0     0 |  96k   13k|  62    42 |66.8M 8332k 81.5M  837M|   0    0    0|  0   0 1.2\r\n  0   0 100   0   0   0| 218B  636B|   0     0 |  27    19 |66.9M 8332k 81.5M  837M|   0    0    0|  0   0   0\r\n  0   0 100   0   0   0| 242B  477B|   0     0 |  29    18 |66.9M 8332k 81.5M  837M|   0    0    0|  0   0   0\r\n  0   0 100   0   0   0| 324B  479B|   0     0 |  28    18 |66.9M 8332k 81.5M  837M|   0    0    0|  0   0   0\r\n\r\n<\/pre>\n<p>\u7edf\u8ba1\u7f51\u53611\u7684\u4fe1\u606f<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# dstat -cdnsil -D hda -N eth1\r\nModule dstat_disk24old failed to load. (No suitable block devices found to monitor)\r\nModule dstat_net failed to load. (No suitable network interfaces found to monitor)\r\n----total-cpu-usage---- ----swap--- ----interrupts--- ---load-avg---\r\nusr sys idl wai hiq siq| used  free|  17    18    19 | 1m   5m  15m \r\n  0   0  99   0   0   0|   0  2016M|   4     0     3 |   0    0    0\r\n  0   0 100   0   0   0|   0  2016M|   0     0     3 |   0    0    0\r\n  0   0 100   0   0   0|   0  2016M|   0     0     4 |   0    0    0\r\n  0   0 100   0   0   0|   0  2016M|   0     0     3 |   0    0    0\r\n  0   0 100   0   0   0|   0  2016M|   0     0     4 |   0    0    0\r\n\r\n<\/pre>\n<p>\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# dstat -vmstat\r\nTerminal width too small, trimming output.\r\n---procs--- ------memory-usage----- ---paging-- -dsk\/total- ---system-- ----total-cpu-usage---- ------memory-usage----- ----swap--- ----system---- ----total-cpu-usage----&gt;\r\nrun blk new| used  buff  cach  free|  in   out | read  writ| int   csw |usr sys idl wai hiq siq| used  buff  cach  free| used  free|  date\/time   |usr sys idl wai hiq siq&gt;\r\n0.0   0 1.1|66.8M 8332k 81.5M  837M|   0     0 |  88k   12k|  59    40 |  0   0  99   0   0   0|66.8M 8332k 81.5M  837M|   0  2016M|05-01 21:52:57|  0   0  99   0   0   0&gt;\r\n  0   0   0|66.8M 8340k 81.5M  837M|   0     0 |   0    12k|  40    27 |  0   0 100   0   0   0|66.8M 8340k 81.5M  837M|   0  2016M|05-01 21:52:58|  0   0 100   0   0   0&gt;\r\n  0   0   0|66.8M 8340k 81.5M  837M|   0     0 |   0     0 |  31    21 |  0   0 100   0   0   0|66.8M 8340k 81.5M  837M|   0  2016M|05-01 21:52:59|  0   0 100   0   0   0&gt;\r\n  0   0   0|66.8M 8340k 81.5M  837M|   0     0 |   0     0 |  28    16 |  0   0 100   0   0   0|66.8M 8340k 81.5M  837M|   0  2016M|05-01 21:53:00|  0   0 100   0   0   0&gt;\r\n  0   0   0|66.8M 8340k 81.5M  837M|   0     0 |   0     0 |  36    19 |  0   0 100   0   0   0|66.8M 8340k 81.5M  837M|   0  2016M|05-01 21:53:01|  0   0 100   0   0   0&gt;\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u65e5\u5e38\u7ba1\u7406\u4e2d\u4f7f\u7528\u9700\u8981\u7ecf\u5e38\u67e5\u770b\u670d\u52a1\u5668\u72b6\u6001\u548c\u6027\u80fd\uff0c\u6bd4\u5982I&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.kiccleaf.com\/?p=312\">Continue reading<span class=\"screen-reader-text\">\u91c7\u7528Linux\u6027\u80fd\u76d1\u6d4b\u5de5\u5177dstat\u6765\u5206\u6790\u7cfb\u7edf\u8d44\u6e90\u60c5\u51b5<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2,"footnotes":""},"categories":[4],"tags":[13,52,69,70],"class_list":["post-312","post","type-post","status-publish","format-standard","hentry","category-linux-","tag-linux","tag-x64","tag-69","tag-70","entry"],"views":6625,"_links":{"self":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312"}],"version-history":[{"count":0,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/312\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}