OSWatcher Balck Box簡介 OSWatcher Black Box (oswbb)是Oracle開發、提供的一個小巧,但是實用、強大的系統工具,它可以用來抓取操作系統的性能指標,用於輔助監控系統的資源使用。其安裝部署、卸載都非常簡單;資源消耗也比較小,原理也十分簡單,它通過調用OS的... ...
OSWatcher Balck Box簡介
OSWatcher Black Box (oswbb)是Oracle開發、提供的一個小巧,但是實用、強大的系統工具,它可以用來抓取操作系統的性能指標,用於輔助監控系統的資源使用。其安裝部署、卸載都非常簡單;資源消耗也比較小,原理也十分簡單,它通過調用OS的的一些命令(例如vmstat、iostat等)來採集、存儲CPU/Memory/Swap/Disk IO/Nentwork相關數據。安裝和運行oswbba可以幫助在性能診斷時提供豐富多樣的各類性能數據、圖文報表支持。
OSWatcher 在4.0的版本時被命名為OSWatcher Black Box,簡稱為oswbb,同時增加了數據分析功能,即OSWatcher Black Box Analyzer (OSWbba)這個繪圖和分析工具,其捆綁在 OS Watcher Black Box當中。替代了之前的OSWg。 也就是說在OSWatcher 4.0 之前是:OSWatcher 和 OSWg的關係,OSWatcher 4.0 後變成了: OSWbb 與 OSWbba 的關係。
OSWatcher Black Box(oswbb)支持多個操作系統,也分Linux與Window版本,當然這兩個版本有所差別,本篇只講述Linux版本。另外,OSWatcher Black Box(oswbb)由兩個部分組成:
1. oswbb: 一個Unix的 shell script腳本集合,其用來收集和歸檔數據,從而幫助定位問題。
2. oswbba: 一個Java工具來自動分析數據,提供建議,並且生成一個包含圖形的 html 文檔。
OSWatcher Black Box(oswbb)的官方下載地址以及相關資料如下(Oracle Metalink上的資料需要賬號)
How To Start OSWatcher Black Box (OSWBB) Every System Boot Using RPM oswbb-service(文檔 ID 580513.1)
OSWatcher Analyzer User Guide (文檔 ID 461053.1)
官方介紹文檔對oswbb,oswbba的介紹如下:
OSWatcher (oswbb) is a collection of UNIX shell scripts intended to collect and archive operating system and network metrics to aid support in diagnosing performance issues. OSWatcher operates as a set of background processes on the server and gathers OS data on a regular basis, invoking such Unix utilities as vmstat, netstat and iostat. OSWatcher can be downloaded from this note. OSWatcher is also included in the RAC-DDT script file, but is not installed by RAC-DDT. For more information on RAC-DDT see RAC-DDT User Guide. OSWatcher is installed on each node where data is to be collected. Installation instructions for OSWatcher are provided in this user guide.
The OSWatcher Analyzer (oswbba) is a graphing and analysis utility which comes bundled with OSWatcher v4.0 and higher. oswbba allows the user to graphically display data collected, generate reports containing these graphs and provides a built in analyzer to analyze the data and provide details on any performance problems it detects. The ability to graph and analyze this information relieves the user of manually inspecting all the files.
NOTE: oswbba replaces the utility OSWg. This was done to eliminate the confusion caused by having multiple tools in support named OSWatcher. oswbba is only supported for data collected by oswbb and no other tool.
安裝OSWatcher
Linux平臺的安裝簡單到了不能再簡單,如下所示,解壓安裝包生成oswbb文件夾。當然你最好將其部署或移動到合適的目錄。
[oracle@DB-Server monitoring]$ tar -xvf oswbb734.tar
[oracle@DB-Server monitoring]$ ls -lrt
total 6196
drwxr-xr-x 6 oracle oinstall 4096 Jul 25 22:22 oswbb
-rw-r--r-- 1 oracle oinstall 6318080 Nov 8 02:33 oswbb734.tar
[oracle@DB-Server monitoring]$ cd oswbb
[oracle@DB-Server oswbb]$ ls –lrt
卸載OSWatcher
卸載OSWatche也是非常簡單,只要稍懂Linux的應該都會。
1:卸載前先停止OSWatcher
./stopOSWbb.sh
2:刪除OSWatcher的目錄oswbb
rm –fr oswbb
啟動OSWatcher
啟動OSWatcher也非常簡單,只需要執行startOSWbb.sh腳本即可,如下所示
./startOSWbb.sh 10 2
後面參數表示10秒採集一次數據,只保留最後採集2個小時的數據在歸檔文件中。首次啟動的日誌最好做一下檢查,註意是否存在Warning信息,如下測試所示,檢查時發現ifconfig命令找不到(oracle賬戶下無法運行ifconfig命令)
[oracle@DB-Server oswbb]$ ./startOSWbb.sh 10 2
[oracle@DB-Server oswbb]$ Setting the archive log directory to/home/oracle/monitoring/oswbb/archive
Testing for discovery of OS Utilities...
VMSTAT found on your system.
IOSTAT found on your system.
MPSTAT found on your system.
Warning... IFCONFIG not found on your system. No IFCONFIG data will be collected.
NETSTAT found on your system.
TOP found on your system.
Testing for discovery of OS CPU COUNT
oswbb is looking for the CPU COUNT on your system
CPU COUNT will be used by oswbba to automatically look for cpu problems
CPU COUNT found on your system.
CPU COUNT = 4
Discovery completed.
Starting OSWatcher v7.3.3 on Sun Dec 4 08:01:57 EST 2016
With SnapshotInterval = 10
With ArchiveInterval = 2
OSWatcher - Written by Carl Davis, Center of Expertise,
Oracle Corporation
For questions on install/usage please go to MOS (Note:301137.1)
If you need further assistance or have comments or enhancement
requests you can email me [email protected]
Data is stored in directory: /home/oracle/monitoring/oswbb/archive
Starting Data Collection...
oswbb heartbeat:Sun Dec 4 08:02:02 EST 2016
oswbb heartbeat:Sun Dec 4 08:02:12 EST 2016
./startOSWbb.sh
如果沒有指定參數,預設參數為30,48,意味著30秒採集一次數據,只保留最後48小時的數據到歸檔文件當中。其實startOSWbb.sh可以定義四個參數
參數1: 指定多少秒採集一次數據。
參數2: 指定採集的數據文件在歸檔路徑保留多少個小時
參數3: 可選參數,打包壓縮工具, 在完成收集後OSW 將使用其來打包壓縮歸檔文件
參數4: 可選參數,指定採集歸檔數據的輸出目錄,預設為系統變數OSWBB_ARCHIVE_DEST的值。
使用上面方式啟動OSWatcher,會被輸出信息一直刷屏。基本上很少使用這種方式,一般使用nohup啟動,這樣可以讓OSW能夠在後臺持續運行併在當前會話終止後不會被掛斷。當然如果系統重啟,那麼OSWatcher就會停止。
nohup ./startOSWbb.sh 30 48 &