Linux下比較全面的監控工具dstat

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'



發佈了21 篇原創文章 · 獲贊 6 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章