Linux下很全面的監控工具dstat

atlantisholic發表於2011-10-12
1)  工具說明

dstat是一個用來替換 vmstat,iostat netstat,nfsstat和ifstat這些命令的工具, 是一個全能系統資訊統計工具. 與sysstat相比, dstat擁有一個彩色的介面, 在手動觀察效能狀況時, 資料比較顯眼容易觀察; 而且dstat支援即時重新整理, 譬如輸入dstat 3, 即每三秒收集一次, 但最新的資料都會每秒重新整理顯示. 和sysstat相同的是, dstat也可以收集指定的效能資源, 譬如 dstat -c 即顯示CPU的使用情況.
下載安裝檔案dstat-0.6.7-1.el*.rf.noarch.rpm: http://dag.wieers.com/rpm/packages/dstat/

2)  軟體安裝

# cd /tmp
# rz (上傳安裝包)
# rpm -Uvh dstat-0.6.7-1.el*.rf.noarch.rpm
# which dstat
/usr/bin/dstat

3)  使用示例

# dstat
安裝完成後, 執行 dstat 命令, 預設情況它會收集-cpu-,-disk-,-net-,-paging-,-system-的資料, 一秒鐘收集一次. 預設輸入dstat等於輸入了dstat -cdngy 1或dstat -a 1. 推薦使用 date && dstat -tclmdny 60 一分鐘監視一次(注意調節顯示的寬度, 或去掉-t選項).

4)  dstat 選項

-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檔案中
這個軟體和vmstat很像, 不過和vmstat相比好像少了io部份的顯示, dstat只能顯示磁碟的吞吐量而不是顯示負載情況, dstat和幾乎所有監控軟體一樣, 只能對整個系統進行監控而不能對某一個程式或某一個程式進行深入分析. 我常使用的引數是dstat -cdlmnpsy, 做個別名連結alias dstat='dstat -cdlmnpsy'

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23071790/viewspace-709009/,如需轉載,請註明出處,否則將追究法律責任。

相關文章