OracleOSWatcher工具怎么用

这篇文章主要为大家展示了“Oracle OS Watcher 工具怎么用”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Oracle OS Watcher 工具怎么用”这篇文章吧。

目前创新互联建站已为上千余家的企业提供了网站建设、域名、网站空间、网站托管、服务器租用、企业网站设计、临高网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。


一、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)

以上是“Oracle OS Watcher 工具怎么用”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!


当前标题:OracleOSWatcher工具怎么用
URL分享:http://pwwzsj.com/article/pigpoc.html