OSWatcher安裝部署與使用

startay發表於2015-12-11

1. 軟體下載與官方Guide:

OSWatcher (Includes: [Video]) (文件 ID 301137.1)
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=423419681198373&parent=DOCUMENT&sourceId=461053.1&id=301137.1&_afrWindowMode=0&_adf.ctrl-state=1bkjd4dvqy_102

OSWatcher User Guide
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=512477130458995&id=1531223.1&_afrWindowMode=0&_adf.ctrl-state=1aew3qvgn6_55

OSWatcher Analyzer User Guide
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=512476365018468&id=461053.1&_afrWindowMode=0&_adf.ctrl-state=1aew3qvgn6_14


在OSW 4.0 之前是:OSWatcher 和 OSWg的關係。
OSW 4.0 後變成了: OSWbb 與 OSWbba 的關係。
 
這樣避免造成名稱上的疑惑。OSWbb收集資料,OSWbba 分析資料。


系統效能是一個綜合性結果的體現。對終端使用者而言,使用系統的體驗感可能就是系統是不是跑得快、在規定時間內完成作業、業務高峰期能否快速開啟頁面。但是,對系統設計、開發和運維人員來講,系統效能是一個綜合性的指標,涉及系統各個組成部分的軟硬體配置和執行狀態。
 
對於資料庫端出現的問題,我們可以使用諸如AWR報告、ASH報告進行全方位的監控和診斷。但是對於作業系統,我們通常需要專門的監控工具,甚至專門的軟體。實際上,各個作業系統(AIX、Linux)都提供了一些基本的效能監控檢查工具,如topas、iostat等,我們需要做的就是週期性的進行工具呼叫和資料收集、分析。Oracle提供的免費工具OS Watcher就是這樣的利器。

目前官方版本是7.33, 下載後壓縮包名為oswbb733.tar

點選(此處)摺疊或開啟

  1. [oracle@cntlxxx ~]$ cd osw/
  2. [oracle@cntlxxx osw]$ ls -lrt
  3. total 6172
  4. -rw-r--r-- 1 oracle oinstall 6318080 Dec 11 10:51 oswbb733.tar

解壓包裡包含了所有涉及到的shell指令碼,tar解壓後可直接使用
  1. [oracle@cntl202 osw]$ tar xvf oswbb733.tar
  2. oswbb/
  3. oswbb/docs/
  4. oswbb/docs/The_Analyzer/
  5. oswbb/docs/The_Analyzer/OSWatcherAnalyzerOverview.pdf
  6. ...(省略部分)...
  7. oswbb/src/
  8. oswbb/src/Thumbs.db
  9. oswbb/src/OSW_profile.htm
  10. oswbb/src/tombody.gif
  11. oswbb/src/missing_graphic.gif
  12. oswbb/src/coe_logo.gif
  13. oswbb/src/watch.gif
  14. oswbb/src/oswbba_input.txt
  15. oswbb/oswrds.sh
  16. [oracle@cntl202 osw]$
  17. [oracle@cntl202 osw]$ cd oswbb

2. 執行程式與資料收集

OS Watcher的本質就是藉助作業系統自身的效能資料收集介面,定期以作業的方式呼叫程式,並且收集資料。OS Watcher基於的幾個常用效能監控程式,如topas,vmstat,iostat。我們呼叫OS Watcher的時候,一定要注意呼叫使用者的許可權情況,要有許可權執行這幾個程式。
 
開啟監控過程,我們需要呼叫startOSWbb.sh指令碼,輸入監控時間引數資訊之後,監控過程就自動開始了。
 
startOSWbb.sh存在四個引數
引數一: 資料收集間隔(單位秒)
引數二:資料儲存期限(單位小時) 用來控制日誌檔案只保留最後N個小時的資訊,這個N由使用者配置,預設是48小時。File Manager 每隔一小時被喚醒一次,用來刪除超過N小時的日誌。
引數三:壓縮格式。
引數四:收集收集路徑。(預設在 ./archive下)

 
下面是啟動指令碼引數說明
  1. [oracle@cntl202 oswbb]$ more startOSWbb.sh
  2. #!/bin/sh

  3. ######################################################################
  4. # Copyright (c) 2005 by Oracle Corporation
  5. # startOSW.sh
  6. # This is the script that starts the OSWatcher program. It accepts 4
  7. # arguments which control the frequency that data is collected and the
  8. # number of hours worth of data to archive.
  9. #
  10. # $1 = snapshot interval in seconds.
  11. # $2 = the number of hours of archive data to store.
  12. # $3 = (optional) the name of the zip or compress utility you want
  13. # OSWbb to use to zip up the archive files upon completion. If
  14. # no zipping is desired set this parameter = NONE. This will
  15. # allow for the $4 parameter below to be recognized as both $3
  16. # and $4 are optional parameters.
  17. # $4 = (optional) the fully qualified name of the archive directory
  18. # where you want oswbb to save your data. This option can be used
  19. # instead of setting the UNIX environment variable OSWBB_ARCHIVE_DEST
  20. # If this parameter is not set oswbb will look for the UNIX
  21. # environment variable OSWBB_ARCHIVE_DEST. If neither are set
  22. # the archive directory will remain in the default location under
  23. # the oswbb directory
  24. #
  25. # If you do not enter any arguments the script runs with default values
  26. # of 30 and 48 meaning collect data every 30 seconds and store the last
  27. # 48 hours of data.
  28. ######################################################################

下面我們嘗試啟動程式。(收集間隔60秒,持續1小時,gzip壓縮,資料存放在/home/oracle/osw/oswbb/archive下

  1. [oracle@cntl202 oswbb]$ ./startOSWbb.sh 60 1 gzip /home/oracle/osw/oswbb/archive
  2. [oracle@cntl202 oswbb]$ Info...Zip option IS specified.
  3. Info...OSW will use gzip to compress files.

  4. Testing for discovery of OS Utilities...
  5. VMSTAT found on your system.
  6. IOSTAT found on your system.
  7. MPSTAT found on your system.
  8. IFCONFIG found on your system.
  9. NETSTAT found on your system.
  10. TOP found on your system.

  11. Testing for discovery of OS CPU COUNT
  12. oswbb is looking for the CPU COUNT on your system
  13. CPU COUNT will be used by oswbba to automatically look for cpu problems

  14. CPU COUNT found on your system.
  15. CPU COUNT = 2

  16. Discovery completed.

  17. Starting OSWatcher v7.3.3 on Fri Dec 11 11:22:46 CST 2015
  18. With SnapshotInterval = 60
  19. With ArchiveInterval = 1

  20. OSWatcher - Written by Carl Davis, Center of Expertise,
  21. Oracle Corporation
  22. For questions on install/usage please go to MOS (Note:301137.1)
  23. If you need further assistance or have comments or enhancement
  24. requests you can email me Carl.Davis@Oracle.com

  25. Data is stored in directory: /home/oracle/osw/oswbb/archive

  26. Starting Data Collection...

 --osw開始收集
  1. oswbb heartbeat:Fri Dec 11 11:22:51 CST 2015
  2. oswbb heartbeat:Fri Dec 11 11:23:51 CST 2015
  3. oswbb heartbeat:Fri Dec 11 11:24:51 CST 2015
  4. oswbb heartbeat:Fri Dec 11 11:25:51 CST 2015
  5. oswbb heartbeat:Fri Dec 11 11:26:51 CST 2015

觀察後臺程式
  1. [oracle@cntl202 oswbb]$ ps -ef|grep osw
  2. oracle 3819 1 0 11:22 pts/0 00:00:00 /bin/sh ./OSWatcher.sh 60 1 gzip /home/oracle/osw/oswbb/archive
  3. oracle 3909 3819 0 11:22 pts/0 00:00:00 /bin/sh ./OSWatcherFM.sh 1 /home/oracle/osw/oswbb/archive

除了經過設定時間終止監控外,OS Watcher還可以透過stopOSWbb.sh指令碼來終止執行

資料均儲存在archive目錄下
  1. [oracle@cntl202 archive]$ ls -lrt
  2. total 40
  3. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswprvtnet
  4. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswvmstat
  5. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswmpstat
  6. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswnetstat
  7. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswiostat
  8. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswifconfig
  9. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswtop
  10. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswps
  11. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswslabinfo
  12. drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswmeminfo

3. OSWBBA資料分析

OS Watcher的全名為Operation System Watcher Black Box(簡稱oswbb)。oswbb只負責收集資料,並不能夠直接分析結果。Oracle在oswbb 4.0之後,提供了專門的分析圖形化工具,oswbba(Operation System Watcher Black Box Analyzer)被加入到oswbb工具包中,對資料可以進行完全的分析和處理。
 
oswbba是一個基於java的軟體,要求執行系統中必須安裝單獨的java程式,並且配置適當的處理空間。由於oswbb是一個純綠色軟體,我們甚至可以把資料複製到windows環境上進行處理。

oswbba的處理包oswbba.jar就儲存在oswbb目錄中。引數-i表示處理的資料目錄。此外,我們還有-START和-STOP引數用於執行處理的時間範圍。

 
下面是oswbba收集方法
  1. [oracle@cntl202 oswbb]$ java -jar oswbba.jar -i /home/oracle/osw/oswbb/archive

  2. Starting OSW Analyzer V7.3.3
  3. OSWatcher Analyzer Written by Oracle Center of Expertise
  4. Copyright (c) 2014 by Oracle Corporation

  5. Parsing Data. Please Wait...

  6. Scanning file headers for version and platform info...


  7. Parsing file cntl202_iostat_15.12.11.1100.dat ...


  8. Parsing file cntl202_vmstat_15.12.11.1100.dat ...


  9. Parsing file cntl202_netstat_15.12.11.1100.dat ...


  10. Parsing file cntl202_top_15.12.11.1100.dat ...


  11. Parsing file cntl202_ps_15.12.11.1100.dat ...


  12. Parsing Completed.



  13. Enter 1 to Display CPU Process Queue Graphs
  14. Enter 2 to Display CPU Utilization Graphs
  15. Enter 3 to Display CPU Other Graphs
  16. Enter 4 to Display Memory Graphs
  17. Enter 5 to Display Disk IO Graphs

  18. Enter 6 to Generate All CPU Gif Files
  19. Enter 7 to Generate All Memory Gif Files
  20. Enter 8 to Generate All Disk Gif Files

  21. Enter L to Specify Alternate Location of Gif Directory
  22. Enter T to Alter Graph Time Scale Only (Does not change analysis dataset)
  23. Enter D to Return to Default Graph Time Scale
  24. Enter R to Remove Currently Displayed Graphs

  25. Enter A to Analyze Data
  26. Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale)

  27. Enter P to Generate A Profile
  28. Enter X to Export Parsed Data to File
  29. Enter Q to Quit Program
oswbb是命令列式的結構,透過輸入數字或者字母來進行控制。從上面提示中,我們輸入1-5數字,就可以顯示出對應引數的趨勢變化曲線圖 (需要呼叫X11)。6-8選項索性會直接將影像生成.gif格式檔案儲存下來,方便後續處理。L-Q主要是控制引數,用來修改處理位置和範圍。
 
4、結論
 
OS Watcher及其分析工具,是非常方便的效能監控程式。在很多場合下,結合資料庫原有的AWR報告,可以讓我們更加全面的瞭解系統瓶頸,最佳化系統。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17086096/viewspace-1870433/,如需轉載,請註明出處,否則將追究法律責任。

相關文章