Linux下系统性能检测利器dstat
生活随笔
收集整理的這篇文章主要介紹了
Linux下系统性能检测利器dstat
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
介紹
dstat是一個用來替換 vmstat,iostat netstat,nfsstat和ifstat這些命令的工具, 是一個全能系統(tǒng)信息統(tǒng)計(jì)工具. 與sysstat相比, dstat擁有一個彩色的界面, 在手動觀察性能狀況時, 數(shù)據(jù)比較顯眼容易觀察; 而且dstat支持即時刷新, 譬如輸入dstat 3, 即每三秒收集一次, 但最新的數(shù)據(jù)都會每秒刷新顯示. 和sysstat相同的是, dstat也可以收集指定的性能資源, 譬如 dstat -c 即顯示CPU的使用情況.
這個軟件和vmstat很像, 不過和vmstat相比好像少了io部份的顯示, dstat只能顯示磁盤的吞吐量而不是顯示負(fù)載情況, dstat和幾乎所有監(jiān)控軟件一樣, 只能對整個系統(tǒng)進(jìn)行監(jiān)控而不能對某一個進(jìn)程或某一個程序進(jìn)行深入分析. 我常使用的參數(shù)是dstat -cdlmnpsy, 做個別名鏈接alias dstat='dstat -cdlmnpsy'
安裝
源碼安裝
http://dag.wieers.com/rpm/packages/dstat/
wget http://rpmforge.sw.be/redhat/7.3/en/i386/rpmforge/RPMS/dstat-0.6.9-1.rh7.rf.noarch.rpm
rpm -ivh dstat-0.6.9-1.rh7.rf.noarch.rpm
Ubuntu:
apt-get install dstat
CentOS:
yum install dstat
選項(xiàng)說明
使用dstat -h查看選項(xiàng)說明
-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èi)存情況
-n, -net ? ? ? ? ? ? ?顯示網(wǎng)絡(luò)情況
-N eth1,total ? ? ? ? 可以指定網(wǎng)絡(luò)接口
-p, -proc ? ? ? ? ? ? enable process stats
-s, -swap ? ? ? ? ? ? 顯示swap情況
-S swap1,total ? ? ? ?可以指定多個swap
-t, -time ? ? ? ? ? ? enable time counter
-y, -sys ? ? ? ? ? ? ?enable system stats
-ipc ? ? ? ? ? ? ? ? ?報(bào)告IPC消息隊(duì)列和信號量的使用情況
-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 ? ? ? ? ? ?只顯示一次表頭以后就不顯示了,使用重定向?qū)懭胛募r很有用
-noupdate ? ? ? ? ? ? disable intermediate updates
-output file ? ? ? ? ?寫入到CVS文件中
使用示例
# dstat
安裝完成后, 執(zhí)行 dstat 命令, 默認(rèn)情況它會收集-cpu-,-disk-,-net-,-paging-,-system-的數(shù)據(jù), 一秒鐘收集一次. 默認(rèn)輸入dstat等于輸入了dstat -cdngy 1或dstat -a 1. 推薦使用 date && dstat -tclmdny 60 一分鐘監(jiān)視一次(注意調(diào)節(jié)顯示的寬度, 或去掉-t選項(xiàng)).
?
我們常用的參數(shù)
-c, --cpu ? ? ? ? ? ? ?enable cpu stats 顯示cpu的情況
-d, --disk ? ? ? ? ? ? enable disk stats 顯示硬盤的情況
-l, --load ? ? ? ? ? ? enable load stats 顯示系統(tǒng)的負(fù)載情況
-m, --mem ? ? ? ? ? ? ?enable memory stats 顯示內(nèi)存的情況
-n, --net ? ? ? ? ? ? ?enable network stats 顯示網(wǎng)絡(luò)的情況
-p, --proc ? ? ? ? ? ? enable process stats 顯示進(jìn)程的情況
-s, --swap ? ? ? ? ? ? enable swap stats 顯示swap的情況
-y, --sys ? ? ? ? ? ? ?enable system stats 顯示系統(tǒng)的情況
--output file ? ? ? ? ?write CSV output to file 寫到csv文件中
默認(rèn)情況下dstat是每秒鐘就收集數(shù)據(jù)一次,可以修改一下讓它每30秒收集一次
dstat -cdlmnpsy 30
dstat -cndymlp -N total -D total 5 25
dstat是一個用來替換 vmstat,iostat netstat,nfsstat和ifstat這些命令的工具, 是一個全能系統(tǒng)信息統(tǒng)計(jì)工具. 與sysstat相比, dstat擁有一個彩色的界面, 在手動觀察性能狀況時, 數(shù)據(jù)比較顯眼容易觀察; 而且dstat支持即時刷新, 譬如輸入dstat 3, 即每三秒收集一次, 但最新的數(shù)據(jù)都會每秒刷新顯示. 和sysstat相同的是, dstat也可以收集指定的性能資源, 譬如 dstat -c 即顯示CPU的使用情況.
這個軟件和vmstat很像, 不過和vmstat相比好像少了io部份的顯示, dstat只能顯示磁盤的吞吐量而不是顯示負(fù)載情況, dstat和幾乎所有監(jiān)控軟件一樣, 只能對整個系統(tǒng)進(jìn)行監(jiān)控而不能對某一個進(jìn)程或某一個程序進(jìn)行深入分析. 我常使用的參數(shù)是dstat -cdlmnpsy, 做個別名鏈接alias dstat='dstat -cdlmnpsy'
安裝
源碼安裝
http://dag.wieers.com/rpm/packages/dstat/
wget http://rpmforge.sw.be/redhat/7.3/en/i386/rpmforge/RPMS/dstat-0.6.9-1.rh7.rf.noarch.rpm
rpm -ivh dstat-0.6.9-1.rh7.rf.noarch.rpm
Ubuntu:
apt-get install dstat
CentOS:
yum install dstat
選項(xiàng)說明
使用dstat -h查看選項(xiàng)說明
-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èi)存情況
-n, -net ? ? ? ? ? ? ?顯示網(wǎng)絡(luò)情況
-N eth1,total ? ? ? ? 可以指定網(wǎng)絡(luò)接口
-p, -proc ? ? ? ? ? ? enable process stats
-s, -swap ? ? ? ? ? ? 顯示swap情況
-S swap1,total ? ? ? ?可以指定多個swap
-t, -time ? ? ? ? ? ? enable time counter
-y, -sys ? ? ? ? ? ? ?enable system stats
-ipc ? ? ? ? ? ? ? ? ?報(bào)告IPC消息隊(duì)列和信號量的使用情況
-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 ? ? ? ? ? ?只顯示一次表頭以后就不顯示了,使用重定向?qū)懭胛募r很有用
-noupdate ? ? ? ? ? ? disable intermediate updates
-output file ? ? ? ? ?寫入到CVS文件中
使用示例
# dstat
安裝完成后, 執(zhí)行 dstat 命令, 默認(rèn)情況它會收集-cpu-,-disk-,-net-,-paging-,-system-的數(shù)據(jù), 一秒鐘收集一次. 默認(rèn)輸入dstat等于輸入了dstat -cdngy 1或dstat -a 1. 推薦使用 date && dstat -tclmdny 60 一分鐘監(jiān)視一次(注意調(diào)節(jié)顯示的寬度, 或去掉-t選項(xiàng)).
?
我們常用的參數(shù)
-c, --cpu ? ? ? ? ? ? ?enable cpu stats 顯示cpu的情況
-d, --disk ? ? ? ? ? ? enable disk stats 顯示硬盤的情況
-l, --load ? ? ? ? ? ? enable load stats 顯示系統(tǒng)的負(fù)載情況
-m, --mem ? ? ? ? ? ? ?enable memory stats 顯示內(nèi)存的情況
-n, --net ? ? ? ? ? ? ?enable network stats 顯示網(wǎng)絡(luò)的情況
-p, --proc ? ? ? ? ? ? enable process stats 顯示進(jìn)程的情況
-s, --swap ? ? ? ? ? ? enable swap stats 顯示swap的情況
-y, --sys ? ? ? ? ? ? ?enable system stats 顯示系統(tǒng)的情況
--output file ? ? ? ? ?write CSV output to file 寫到csv文件中
默認(rèn)情況下dstat是每秒鐘就收集數(shù)據(jù)一次,可以修改一下讓它每30秒收集一次
dstat -cdlmnpsy 30
dstat -cndymlp -N total -D total 5 25
總結(jié)
以上是生活随笔為你收集整理的Linux下系统性能检测利器dstat的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在Ubuntu 12.04 64bit上
- 下一篇: Linux的watch命令--实时监测命