天天看點

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;

linux 性能檢測工具之 dstat

如果我們執行 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'

例 圖:

linux 性能檢測工具之 dstat

繼續閱讀