Oracle OS Watcher 工具

不一樣的天空w發表於2017-12-08
參考:
Oracle OS Watcher 工具 使用詳解
http://blog.csdn.net/tianlesoftware/article/details/7316191

MOS相關文件:
下載:1526578.1 或者 301137.1
OS Watcher User's Guide (文件 ID 1531223.1)
OSWatcher Analyzer User Guide (文件 ID 461053.1)

一、OS Watcher Black Box 安裝配置(oswbb)
1.下載oswbb的tar包,解壓即可並授權:
tar xvf oswbb.tar

chmod 744 *

2.解除安裝:
要解除安裝OSWatcher,請在oswbb目錄中發出以下命令:

rm -rf oswbb

3.設定OSWbb
當OSWbb 安裝完成之後,就可以使用start 和stop 指令碼,在OSWbb第一次使用時,它會建立一些歸檔的子目錄。 這些歸檔目錄包含7個子目錄,每一個子目錄對應一個收集資料。 這7個目錄分別對應:top, vmstat, iostat, mpstat, netstat, ps 和一個可選的traceprivate network。
要啟動private network,必須先在oswbb目錄下建立一個private.net的可執行檔案。 這個檔案裡的內容可以是用來驗證RAC private network的traceroute命令

設定私網間通訊檢查:
a)進入解壓目錄,複製Exampleprivate.net 為 private.net 到同一個目錄下。
b).在private.net中找到您對應的系統平臺,替換下面的private_nodename1 , private_nodename2 為具體的私網IP或者主機名
traceroute -r -F private_nodename1
traceroute -r -F private_nodename2
c). 將private.net中其它的平臺部分刪除。
d). 千萬不要刪除下面的內容:rm locks/lock.file


4.啟動/停止oswbb Starting / Stopping oswbb

啟動oswbb:Starting oswbb
To start the oswbb utility execute the startOSWbb.sh shell script from the directory where oswbb was installed. This script has 2 arguments which control the frequency that data is collected and the number of hour's worth of data to archive.

    ARG1 = snapshot interval in seconds.
    ARG2 = the number of hours of archive data to store.
    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.

If you do not enter any arguments the script runs with default values of 30 and 48 meaning collect data every 30 seconds and store the last 48 hours of data in archive files.
--如果沒有在啟動時沒有指定這2個引數,那麼預設情況是30秒收集一次,歸檔資料保留48個小時。

Example 1: This would start the tool and collect data at default 30 second intervals and log the last 48 hours of data to archive files.
這將啟動該工具並以預設的30秒間隔收集資料,並將最近48小時的資料記錄到歸檔檔案
./startOSWbb.sh

Example 2: This would start the tool and collect data at 60 second intervals and log the last 10 hours of data to archive files and automatically compress the files.
示例2:這將啟動該工具並以60秒為間隔收集資料,並記錄最近10小時的資料以歸檔檔案並自動壓縮檔案。
./startOSWbb.sh 60 10 gzip

Example 3: This would start the tool and collect data at 60 second intervals and log the last 10 hours of data to archive files, compress the files and set the archive directory to a non-default location.
示例3:這將啟動該工具並以60秒為間隔收集資料,並記錄最近10小時的資料以歸檔檔案,壓縮檔案並將歸檔目錄設定為非預設位置

./startOSWbb.sh 60 10 gzip /u02/tools/oswbb/archive

Example 4: This would start the tool and collect data at 60 second intervals and log the last 48 hours of data to archive files, NOT compress the files and set the archive directory to a non-default location.
示例4:這將啟動該工具並以60秒為間隔收集資料,並將最後48小時的資料記錄到歸檔檔案,而不是壓縮檔案,並將歸檔目錄設定為非預設位置。
./startOSWbb.sh 60 48 NONE /u02/tools/oswbb/archive

Example 5: This would start the tool, put the process in the background, enable to the tool to continue running after the session has been terminated, collect data at 60 second intervals, and log the last 10 hours of data to archive files.
示例5:這將啟動該工具,將該程式置於後臺,使該工具在會話終止後繼續執行,以60秒為間隔收集資料,並將最近10小時的資料記錄到歸檔檔案
nohup ./startOSWbb.sh 60 10 &

停止oswbb:Stopping oswbb

To stop the oswbb utility execute the stopOSWbb.sh command from the directory where oswbb was installed. This terminates all the processes associated with the tool.

Example:

./stopOSWbb.sh


二、OS Watcher Black Box Analyzer安裝配置(oswbba)
MOS:OS Watcher Black Box Analyzer User Guide [ID 461053.1]

2.1在啟動OSWbba 工具之前,必須先安裝java 1.4.2 或以上版本。 當然如果安裝過了Oracle,那麼oracle 安裝目錄裡也有java。
[root@dbrac1 ~]# su - oracle
[oracle@dbrac1]$ java -version
java version"1.6.0_20"
OpenJDK RuntimeEnvironment (IcedTea6 1.9.7) (rhel-1.39.1.9.7.el6-x86_64)
OpenJDK 64-BitServer VM (build 19.0-b09, mixed mode)
--我這裡安裝的java 是1.6 的版本。

如果使用Oracle的Java,那麼需要修改一下環境變數,在Path裡新增Java的路徑,如:
PATH=$ORACLE_HOME/jdk/bin:$PATH

2.2啟動oswbba
注意這裡顯示圖片需要條用X windows或xmanger圖形工具,所以我們要在圖形視窗中執行
Once the correct version of java has been verified, you can start oswbba. oswbba requires an input directory to run. To specify the input directory you must use the -i option. The input directory is the fully qualified path name of an archive directory location containing the oswbb logs. The archive directory must contain the respective subdirectories--oswvmstat, oswiostat, oswps, oswtop, oswnetstat, etc. If you are running Linux or HP-UX, then additional directories are also created. It is important to note the program requires an archive directory name not an individual log directory name or individual filename.
一旦正確的java版本得到驗證,您就可以啟動oswbba。  oswbba需要一個輸入目錄才能執行。 要指定輸入目錄,您必須使用-i選項。 輸入目錄是包含oswbb日誌的歸檔目錄位置的標準路徑名。 存檔目錄必須包含相應的子目錄 -  oswvmstat,oswiostat,oswps,oswtop,oswnetstat等。如果您正在執行Linux或HP-UX,則還會建立其他目錄。 需要注意的是,程式需要一個存檔目錄名稱,而不是一個單獨的日誌目錄名稱或個人檔名

命令如下:

--注意這裡顯示圖片需要條用X windows,所以我們要在圖形視窗中執行:xhost +,在虛擬機器終端root使用者介面執行

[root@dbrac1]# xhost +

access control disabled, clients canconnect from any host

[root@dbrac1 ~]# su - oracle
[oracle@dbrac1 oswbb]$ pwd
/home/oracle/oswbb/oswbb
[oracle@dbrac1 oswbb]$
[oracle@dbrac1 oswbb]$ ls oswbba.jar
oswbba.jar
[oracle@dbrac1 oswbb]$
[oracle@dbrac1 oswbb]$ java -jar oswbba.jar -i /home/oracle/oswbb/oswbb/archive



輸出如下:
Starting OSWbba V8.0.0
OSWatcher Analyzer Written by Oracle Center of Expertise
Copyright (c)  2017 by Oracle Corporation

Parsing Data. Please Wait...

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 5 to Display NFS Graphs

Enter GC to Generate All CPU Gif Files
Enter GM to Generate All Memory Gif Files
Enter GD to Generate All Disk Gif Files
Enter GN to Generate All Network Gif Files
Enter GF to Generate All NFS Gif Files

Enter A to Analyze Data
Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale
Enter D to Generate Dashboard

Enter L to Specify Alternate Location of Gif Directory
Enter T to Specify Different Time Scale
Enter B to Return to Default Time scale
Enter R to Remove Currently Displayed Graphs
Enter X to Export Parsed Data to File
Enter Q to Quit Program

Please Select an Option:

2.2 Java Heap Errors on Startup:啟動時出現Java堆錯誤

oswbba parses all the archive files in memory prior to generating graphs or performing an analysis. If you have a large amount of files to parse you may need to allocate more memory in the java heap. If you experience any error messages regarding out of memory such as java.lang.OutOfMemoryError, you may have to increase the size of the java heap. To increase the size of the java heap use the -Xmx flag.
oswbba在生成圖形或執行分析之前解析記憶體中的所有歸檔檔案。 如果你有大量的檔案解析你可能需要在java堆中分配更多的記憶體。 如果您遇到關於記憶體不足(如java.lang.OutOfMemoryError)的任何錯誤訊息,則可能需要增加java堆的大小。 要增加java堆的大小,請使用-Xmx標誌。

$java -jar -Xmx512M oswbba.jar -i /u02/home/oswbb/archive

Starting oswbba V7.0
OSWatcher Analyzer Written by Oracle Center of Expertise
Copyright (c)  2012 by Oracle Corporation

Parsing Data. Please Wait...

2.3停止oswbba/Stopping oswbba

To stop the oswbba utility select option "Q" from the menu.
要停止oswbba實用程式,請從選單中選擇選項"Q"。


2.4 oswbba的使用方式:

在任何情況下,oswbba都必須使用-i標誌提供存檔目錄位置

2.4.1 Using oswbba: Menu Option(選單使用方式)
命令如下:
java -jar oswbba.jar -i

After starting oswbba, a set of options will display.  Enter an option value and hit return.
啟動oswbba後,會顯示一組選項。 輸入一個選項值並點選返回

OPTIONS:
The following options are supported:

1..3     These options display graphs of specific CPU components of vmstat. Option 1 displays the process run, wait and block queues. Option 2 displays CPU utilization graphs for system, user and idle. Option 3 displays graphs for context switches and interrupts.
這些選項顯示vmstat的特定CPU元件的圖形。 選項1顯示程式執行,等待和阻塞佇列。 選項2顯示系統,使用者和空閒的CPU利用率圖。 選項3顯示上下文切換和中斷的圖形

4       This option displays memory graphs for free memory and available swap.
         此選項顯示可用記憶體和可用交換的記憶體圖

5       this option displays graphs for disk i/o. The device name along with the average service time of each device is then listed. The user then selects one of the devices out of the list of devices. Graphs are available for reads/second, writes/second, service time and percent busy.
此選項顯示磁碟I / O的圖形。 然後列出裝置名稱以及每個裝置的平均服務時間。 使用者然後從裝置列表中選擇一個裝置。 圖表可用於讀取/秒,寫入/秒,服務時間和繁忙百分比

6       This option display nfs statistics. This option is available only on Linux and only if nfsiostat is enabled in OSWatcher
        這個選項顯示nfs統計資訊。 此選項僅在Linux上可用,且僅在OSWatcher中啟用了nfsiostat時才可用

GC      Generates image files of the graphs associated with OS CPU (Option 1, 2, 3 above). These files are by default written to the gif directory but can be written to any directory by the use of Option L below.
        生成與OS CPU關聯的圖形的影像檔案(上面的選項1,2,3)。 這些檔案預設寫入gif目錄,但可以透過使用下面的選項L寫入任何目錄。

GM      Generates image files of the graphs associated with OS memory (Option 4 above). These files are by default written to the gif directory but can be written to any directory by the use of Option L below.
        生成與OS記憶體相關的圖形的影像檔案(上面的選項4)。 這些檔案預設寫入gif目錄,但可以透過使用下面的選項L寫入任何目錄。

GD      Generates image files of i/o stats (Option 5 above). These files are by default written to the gif directory but can be written to any directory by the use of Option L below.
生成I / O統計的影像檔案(上面的選項5)。 這些檔案預設寫入gif目錄,但可以透過使用下面的選項L寫入任何目錄

GN     Generates image files of the graphs associated with OS network (Option 5 above). These files are by default written to the gif directory but can be written to any directory by the use of Option L below.
       生成與OS網路相關的圖形的影像檔案(上面的選項5)。 這些檔案預設寫入gif目錄,但可以透過使用下面的選項L寫入任何目錄

GF     Generates image files of the graphs associated with NFSIOSTAT for Linux only (Option 6 above). These files are by default written to the gif directory but can be written to any directory by the use of Option L below.
       僅生成與NFSIOSTAT for Linux相關的圖形的影像檔案(上面的選項6)。 這些檔案預設寫入gif目錄,但可以透過使用下面的選項L寫入任何目錄

L     This option allows the user to specify an alternative location to place the image and data (XLS) files.
      此選項允許使用者指定替代位置來放置影像和資料(XLS)檔案

T     By default OSWbba parses all the OSWbb log files contained in the input directory and the default graphs are based on the entire time span of all the logs. By default, OSWbb keeps the last 48 hours of logs in the archive. This means the default graph will graph all  48 hours of data. This option allows the user to specify a different subset of times within the entire collection. An example would be only to graph a 2 hour period out of the entire 48 hour collection.
      預設情況下,OSWbba解析輸入目錄中包含的所有OSWbb日誌檔案,預設的圖形基於所有日誌的整個時間跨度。 預設情況下,OSWbb會將最近48小時的日誌保留在歸檔中。 這意味著預設圖形將繪製所有48小時的資料。 該選項允許使用者在整個集合中指定不同的時間子集。 一個例子只是繪製整個48小時收集中的2小時

B    This option resets the graphing timescale back to the time encompassing the entire log collection. Please note this resets the time for graphs but does not reset the time for analysis.
     該選項將圖表時間表重新設定為包含整個日誌收集的時間。 請注意,這會重置圖表的時間,但不會重置分析的時間

R    This option removes all graphs from the screen.
     該選項從螢幕上刪除所有圖形。

X    This option exports the analyzer parsed data to flat files that can be loaded into a spreadsheet. The exported data is written to the data subdirectory.
     此選項將分析器分析的資料匯出到可以載入到電子表格中的平面檔案。 匯出的資料被寫入資料子目錄

A    This option analyzes the files in the archive and produces a report.
     該選項分析存檔中的檔案並生成報告

S    This option analyzes a subset of the data in the oswbb directory and produces a report in the analysis directory.
     該選項分析oswbb目錄中的資料子集,並在分析目錄中生成報告

D    Generates a responsive web page dashboard. The dashboard integrates the analyzer text base report (option A) with a menu driven interface that quickly helps identifies critical issues and provides guidance on what to look for. Selecting this option will first generate the analysis option (A) as this data is required for the dashboard option.
     生成響應式網頁儀表板。 儀表板將分析器文字基礎報告(選項A)與選單驅動的介面整合在一起,可快速識別關鍵問題並提供關於尋找內容的指導。 選擇此選項將首先生成分析選項(A),因為儀表板選項需要此資料。

Q   Exits the program.退出程式

2.4.2 Using oswbba: Command Line Option(命令列使用方式)
所有圖形,儀表板生成和分析選項都可以從命令列傳遞到oswbba。 只有-i選項是必需的。 使用下表來新增其他選項:

java -jar oswbba.jar -i -P -L -6 -7 -8

Example:

java -jar oswbba.jar -i archive -6 -7 -P tuesday_crash

選項命令如下
The following options are supported:

-i Required. This is the input archive directory location.

-GC Same as option GC from the menu. Will generate all cpu gif files.

-GM Same as option GM from the menu. Will generate all memory gif files.

-GD Same as option GD from the menu. Will generate all disk gif files.

-GN Same as option GN from the menu. Will generate all network gif files.

-GF Same as option GF from the menu. Will generate all nfs gif files.

-S  This option used with other options to identify only a subset of the data in the oswbb directory will be used for analysis.
    此選項與其他選項一起使用,僅用於識別oswbb目錄中的一部分資料,將用於分析

-L User specified location of an existing directory to place any gif files or data files (xls files) generated by oswbba. This overrides the oswbba default location. This directory must pre-exist!
   <位置名稱>使用者指定的現有目錄位置,用於放置由oswbba生成的任何gif檔案或資料檔案(xls檔案)。 這覆蓋了oswbba的預設位置。 這個目錄必須預先存在!

-A  Same as option A above. This option analyzes the files in the archive directory and produces a report in the analysis directory. If you do not specify an analysis directory, then the files will be placed in a system generated directory name under the analysis directory. If you do not want to put the optional name make sure this is the last option on the command line.
   <可選分析目錄名>與上面的選項A相同。 該選項分析歸檔目錄中的檔案,並在分析目錄中生成報告。 如果不指定分析目錄,則檔案將被放置在分析目錄下的系統生成的目錄名稱中。 如果你不想把可選的名字,確保這是命令列上的最後一個選項

-D  Same as option D above. This option generates a dashboard (responsive web page). The dashboard integrates the analyzer text base report (option A) with a menu driven interface that quickly helps identifies critical issues and provides guidance on what to look for. Selecting this option will first also force the analysis (-A) to happen. If you do not specify an analysis directory, then the files will be placed in a system generated directory name under the analysis directory. If you do not want to put the optional name make sure this is the last option on the command line
<可選分析目錄名>與上面的選項D相同。 該選項會生成一個儀表板(響應式網頁)。 儀表板將分析器文字基礎報告(選項A)與選單驅動的介面整合在一起,可快速識別關鍵問題並提供關於尋找內容的指導。 選擇此選項將首先強制執行分析(-A)。 如果不指定分析目錄,則檔案將被放置在分析目錄下的系統生成的目錄名稱中。 如果你不想把可選的名字,確保這是命令列上的最後一個選項

-START Used with the analysis option to specify the first file located in the oswvmstat directory to analyze.
       與分析選項一起使用,指定位於oswvmstat目錄中的第一個檔案進行分析
       
-STOP  Used with the analysis option to specify the last file located in the oswvmstat directory to analyze.
       與分析選項一起使用,指定位於oswvmstat目錄中的最後一個檔案進行分析

-B    Same as option T from the menu. The begin time will allow the user to select a begin time from within the archive of files to graph. This overrides the default start time which is the earliest time entry in the archive directory.  The format of the start time is  Mon DD HH:MM:SS YYYY. (Example :Jul 25 11:58:01 2007). An invalid begin time will result in using a default value of the first timestamp in your archive.
      <開始時間>與選單中的選項T相同。 開始時間將允許使用者從檔案存檔中選擇開始時間到圖形。 這將覆蓋存檔目錄中最早時間條目的預設開始時間。 開始時間的格式是Mon DD HH:MM:SS YYYY。  (例如:2007年7月25日115801)。 無效的開始時間將導致在您的存檔中使用第一個時間戳的預設值

-E   Same as option T from the menu. The end time will allow the user to select an end time from within the archive of files to graph. This overrides the default end time which is the latest time entry in the archive directory.  The format of the end time is  Mon DD HH:MM:SS YYYY. (Example :Jul 25 11:58:01 2007).An invalid end time will result in using a default value of the last timestamp in your archive
     <結束時間>與選單中的選項T相同。 結束時間將允許使用者從檔案存檔中選擇結束時間到圖形。 這會覆蓋歸檔目錄中最後一次輸入的預設結束時間。 結束時間的格式是星期一夜間:MM:SS年。  (例如:7月25日115801 2007年)。無效的結束時間將導致您的檔案中使用上次時間戳的預設值
     
2.4.3 Specifying the Begin/End Time of an Analysis (Recommended Method)指定分析的開始/結束時間(推薦方法)

示例:
java -jar oswbba.jar -i archive -b Jan 9 13:15:00 2013 -e Jan 19 13:30:00 2013 -A

2.4.4 Limiting the Analysis to a Subset of Files in Your Archive (Old method) 將分析限制為存檔中檔案的子集(舊方法)

示例:
java -jar oswbba.jar -i archive -START coesrv40.us.oracle.com_vmstat_13.01.09.1300.dat -STOP coesrv40.us.oracle.com_vmstat_13.01.09.2000.dat -s

2.4.5 Ignoring Specific Directories From Analysis忽略來自分析的特定目錄

示例:
java -jar oswbba.jar -i archive -NO_NETSTAT -NO_IOSTAT

可選項如下:
-NO_IOSTAT Ignores files in the oswiostat directory from analysis.

-NO_TOP    Ignores files in the oswtop directory from analysis.

-NO_PS     Ignores files in the oswps directory from analysis.

-NO_NETSTAT Ignores files in the oswnetstat directory from analysis.

-NO_LINUX   Ignores files in the oswmeminfo directory from analysis.

-MEM_ALL    Analyzes virtual and resident memory allocations for all processes. This is very resource intensive.

2.4.6 Generating a Dashboard 生成儀表板
步驟如下:
1. Select option (D) from them menu. This generates the dashboard
2. cd to the analysis directory
3. Locate the analysis directory generated in step 1
4. cd into the specific analysis directory
5. Inside the specific analysis directory there will be
   a. single analysis.txt file
   b. directory named dashboard
6. cd into the dashboard directory
7. Inside the dashboard directory there will be
   a. index.html (This is the dashboard). Open this file with a browser
   b. css directory containing cascading style sheets used by the dashboard
   c. fonts directory containing fonts used by the dashboard
   d. generated_files directory containing gifs that were generated and used by the dashboard
   e. images directory containing misc images used by the dashboard
   f. js directory containing javascript used by the dashboard
   
三、配置oswbb自啟
目的是重啟主機使oswbb重新拉起工作收集資訊

方法一:配置crontab

0,5,10,15,20,25,30,35,40,45,50,55  * * * * /home/oracle/dba/check_oswbb.sh >/dev/null 2>&1

[oracle:/home/oracle]$cat /home/oracle/dba/check_oswbb.sh
#!/bin/sh
. /home/oracle/.profile
osw_p=`ps -ef|grep -i "OSWatcher"|grep -v "grep"|wc -l`;
if [ $osw_p -eq 0  ];
then
   cd  /oracle/dba/oswbb
   nohup ./startOSWbb.sh 15 168 gzip &
fi

[oracle:/home/oracle]$

方法二:MOS:USing oswatcher RPM Package on Oracle Linux (文件 ID 2290852.1)


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

相關文章