linux 性能檢測工具之 dstat

     這幾天在做lamp性能調優,對系統性能檢測使用top vmstat 發現非常不妨便,在剛開會的時候, @mandahang 介紹了一個軟件 dstat,用起來感覺還真不錯。

下面則對dstat 做下簡單的介紹:

一、安裝

1.在centos下 可以 yum -y instatll dstat

2. 下載rpm包進行安裝

 wget http://packages.sw.be/dstat/dstat-0.7.2-1.el5.rfx.noarch.rpm

 rpm -ivh dstat-0.7.2-1.el5.rfx.noarch.rpm

二、使用

1.執行 dstat 命令的時候,默認他會 收集-cpu-、-disk-、-net-、-paging-、-system-的數據,一秒鐘收集一次。默認輸入 dstat 等於輸入了dstat -cdngy 1或dstat -a 1;

 

如果我們執行 dstat 3 命令的話,他就是3秒收集一次信息。

2.同樣的 dstat 也可以收集指定的性能資源。使用 dstat -h 可以看到相應的參數。

  Dstat options:

  -c, --cpu              顯示CPU情況

  -C 0,3,total           include cpu0, cpu3 and total

  -d, --disk             顯示磁盤情況

  -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              顯示內存情況

  -n, --net              顯示網絡情況

  -N eth1,total          可以指定網絡接口

  -p, --proc             enable process stats

  -s, --swap             顯示swap情況

  -S swap1,total         可以指定多個swap

  -t, --time             enable time counter

  -y, --sys              enable system stats

  --ipc                  報告IPC消息隊列和信號量的使用情況

  --lock                 enable lock stats

  --raw                  enable raw stats

  --tcp                  enable tcp stats

  --udp                  enable udp stats

  --unix                 enable 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

  --output file          寫入到CVS文件中

  dstat -cdlmnpsy

  在1024×768的屏幕上正好全部顯示出來

  別名  alias dstat='dstat -cdlmnpsy'

例 圖:

我們選擇 cdlmnpsyt 幾個參數 讓它5秒刷新一次

他會針對 cpu 磁盤 load 內存 網絡 process swap 時間 等具體資源,進行抓取信息。也許是由於以前不知道,新鮮感吧,今天用這個工具感覺還是聽不錯的。

   知道的朋友們就當看個熱鬧,沒用過的,可以試一試,嘿嘿,真的還不錯。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章