使用Dstat監控Linux系統資源

官方網站:http://dag.wieers.com/rpm/packages/dstat/
  • Dstat的安裝:
Dstat的使用:
安裝完成後,執行 dstat 命令,默認情況它會收集-cpu-、-disk-、-net-、-paging-、-system-的數據,一秒鐘收集一次。
默認輸入 dstat 等於輸入了dstat -cdngy 1或dstat -a 1;
推薦使用 date && dstat  -tclmdny 60 一分鐘監視一次(注意調節顯示的寬度,或去掉-t選項)。


SysStat相比,Dstat擁有一個彩色的界面,在手動觀察性能狀況時,數據比較顯眼容易觀察;
而且Dstat支持即時刷新,譬如:輸入 dstat 3,即每三秒收集一次,但最新的數據都會每秒刷新顯示。
SysStat相同的是,Dstat也可以收集指定的性能資源。譬如 dstat -c 即顯示CPU的使用情況。
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
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq|_read _writ|_recv _send|__in_ _out_|_int_ _csw_
13  49  29   8   1   1| 424k   23k|   0     0 |   0     0 | 275   200
  0   1  95   3   0   1|8192B    0 | 297B   70B|   0     0 | 241    33
  0   1  99   0   0   0|   0     0 |  92B    0 |   0     0 | 243    14
  0   1  99   0   0   0|   0     0 | 395B    0 |   0     0 | 244    20

很簡單,一看就明白了,
要說明的是如果當usr和sys的數值大於80時說明cpu的負載過重,這個軟件和vmstat很像,
不過和vmstat相比好像少了io部份的顯示dstat只能顯示磁盤的吞吐量而不是顯示負載情況

dstat和幾乎所有監控軟件一樣,只能對整個系統進行監控而不能對某一個進程或某一個程序進行深入分析。

常用命令
dstat -cndymlp -N total -D total 5 25  統計CPU,IO ,network,system load

dstat -cdnsil -D hda -N eth1 統計網卡1的信息

dstat ?vmstat 內存使用情況


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