OSWatcher Black Box (oswbb)是Oracle開(kāi)發(fā)、提供的一個(gè)小巧,但是實(shí)用、強(qiáng)大的系統(tǒng)工具,它可以用來(lái)抓取操作系統(tǒng)的性能指標(biāo),用于輔助監(jiān)控系統(tǒng)的資源使用。其安裝部署、卸載都非常簡(jiǎn)單;資源消耗也比較小,原理也十分簡(jiǎn)單,它通過(guò)調(diào)用OS的的一些命令(例如vmstat、iostat等)來(lái)采集、存儲(chǔ)CPU/Memory/Swap/Disk IO/Nentwork相關(guān)數(shù)據(jù)。安裝和運(yùn)行oswbba可以幫助在性能診斷時(shí)提供豐富多樣的各類(lèi)性能數(shù)據(jù)、圖文報(bào)表支持。
OSWatcher 在4.0的版本時(shí)被命名為OSWatcher Black Box,簡(jiǎn)稱(chēng)為oswbb,同時(shí)增加了數(shù)據(jù)分析功能,即OSWatcher Black Box Analyzer (OSWbba)這個(gè)繪圖和分析工具,其捆綁在 OS Watcher Black Box當(dāng)中。替代了之前的OSWg。 也就是說(shuō)在OSWatcher 4.0 之前是:OSWatcher 和 OSWg的關(guān)系,OSWatcher 4.0 后變成了: OSWbb 與 OSWbba 的關(guān)系。
? ? ? OSWatcher Black Box(oswbb)支持多個(gè)操作系統(tǒng),也分Linux與Window版本,當(dāng)然這兩個(gè)版本有所差別,本篇只講述Linux版本。另外,OSWatcher Black Box(oswbb)由兩個(gè)部分組成:
oswbb: 一個(gè)Unix的 shell script腳本集合,其用來(lái)收集和歸檔數(shù)據(jù),從而幫助定位問(wèn)題。
oswbba: 一個(gè)Java工具來(lái)自動(dòng)分析數(shù)據(jù),提供建議,并且生成一個(gè)包含圖形的 html 文檔。
安裝與卸載
軟件安裝
工具卸載
rm -rf oswbb
啟動(dòng)與停止
啟動(dòng)OSWatcher
startOSWbb.sh腳本有四個(gè)參數(shù):
ARG1 = snapshot interval in seconds.?(間隔時(shí)間)
ARG2 = the number of hours of archive data to store.?(多長(zhǎng)時(shí)間)
ARG3 = (optional) the name of a compress utility to compress each file automatically after it is created.?(壓縮格式)
ARG4 = (optional) an alternate (non default) location to store the archive directory.(存放目錄)
如果不輸入任何參數(shù),默認(rèn)間隔30秒收集一次數(shù)據(jù),并且默認(rèn)保存48小時(shí)的數(shù)據(jù)。
默認(rèn)收集到的數(shù)據(jù)會(huì)存儲(chǔ)在解壓目錄下的archive目錄下,這個(gè)目錄是在第一次啟動(dòng)startOSWbb.sh腳本時(shí)創(chuàng)建的。
啟動(dòng)命令
./startOSWbb.sh 60 10 gzip /u01/soft/oswbb/archive
停止命令
./stopOSWbb.sh
分析OSWatcher收集到的日志
使用oswbba.jar包進(jìn)行日志的分析,但是jara要在1.4.2及以上版本。
兩種方法分析數(shù)據(jù)
1)生成圖形
#cd /u01/oswatcher
#java -jar oswbba.jar -i /u01/oswatcher/archive/ -b May 3 00:00:00 2018 -e May 3 23:59:59 2018
[oracle@rhel6?oswbb]$?export?DISPLAY=192.168.56.1:0.0
[oracle@rhel6?oswbb]$?java?-jar?oswbba.jar?-i?archive
Starting?OSW?Analyzer?V7.3.3
OSWatcher?Analyzer?Written?by?Oracle?Center?of?Expertise
Copyright?(c)??2014?by?Oracle?Corporation
Parsing?Data.?Please?Wait...
Scanning?file?headers?for?version?and?platform?info...
Parsing?file?rhel6_iostat_16.12.19.1100.dat?...
Parsing?file?rhel6_vmstat_16.12.19.1100.dat?...
Parsing?file?rhel6_netstat_16.12.19.1100.dat?...
Parsing?file?rhel6_top_16.12.19.1100.dat?...
Parsing?file?rhel6_ps_16.12.19.1100.dat?...
Parsing?Completed.
Enter?1?to?Display?CPU?Process?Queue?Graphs
Enter?2?to?Display?CPU?Utilization?Graphs
Enter?3?to?Display?CPU?Other?Graphs
Enter?4?to?Display?Memory?Graphs
Enter?5?to?Display?Disk?IO?Graphs
Enter?6?to?Generate?All?CPU?Gif?Files
Enter?7?to?Generate?All?Memory?Gif?Files
Enter?8?to?Generate?All?Disk?Gif?Files
Enter?L?to?Specify?Alternate?Location?of?Gif?Directory
Enter?T?to?Alter?Graph?Time?Scale?Only?(Does?not?change?analysis?dataset)
Enter?D?to?Return?to?Default?Graph?Time?Scale
Enter?R?to?Remove?Currently?Displayed?Graphs
Enter?A?to?Analyze?Data
Enter?S?to?Analyze?Subset?of?Data(Changes?analysis?dataset?including?graph?time?scale)
Enter?P?to?Generate?A?Profile
Enter?X?to?Export?Parsed?Data?to?File
Enter?Q?to?Quit?Program
Please?Select?an?Option:7
Generating?file?gif/Dec19110157_1482117313/OSWg_OS_Memory_Swap.gif
Generating?file?gif/Dec19110157_1482117313/OSWg_OS_Memory_Free.gif
Generating?file?gif/Dec19110157_1482117313/OSWg_OS_Memory_Page_In_Rate.gif
2)生成報(bào)告
[oracle@rhel6?oswbb]$?java?-jar?oswbba.jar?-i?archive?-A
Scanning?file?headers?for?version?and?platform?info...
Parsing?file?rhel6_iostat_16.12.19.1100.dat?...
Parsing?file?rhel6_vmstat_16.12.19.1100.dat?...
Parsing?file?rhel6_netstat_16.12.19.1100.dat?...
Parsing?file?rhel6_top_16.12.19.1100.dat?...
Parsing?file?rhel6_ps_16.12.19.1100.dat?...
Dates?accepted.?Verifying?valid?begin/end?data?points...
Validating?times?in?the?archive...
Recalibrating?data...
Scanning?file?headers?for?version?and?platform?info...
Parsing?file?rhel6_iostat_16.12.19.1100.dat?...
Parsing?file?rhel6_vmstat_16.12.19.1100.dat?...
Parsing?file?rhel6_netstat_16.12.19.1100.dat?...
Parsing?file?rhel6_top_16.12.19.1100.dat?...
Parsing?file?rhel6_ps_16.12.19.1100.dat?...
A?new?analysis?file?analysis/rhel6_1482117679897.txt?has?been?created.
#生成的分析報(bào)告在analysis目錄中
[oracle@rhel6?oswbb]$?more?analysis/rhel6_1482117679897.txt
This?report?is?best?viewed?in?a?fixed?font?editor?like?textpad...
OSWatcher?Analyzer
Input?Archive:???????archive
Archive?Source?Dest:?/home/oracle/oswatcher/oswbb/archive
Archive?Start?Time:??Dec?19?11:01:57?2016
Archive?Stop?Time:???Dec?19?11:20:59?2016
Hostname:????????????RHEL6
OS?Version:??????????Linux
Snapshot?Freq:???????15
CPU?COUNT:???????????2
......
Subsystem???????Status
------------------------
CPU?????????????OK
MEMORY??????????OK
I/O?????????????WARNING?
NET?????????????OK
......