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
点击(此处)折叠或打开
- [oracle@cntlxxx ~]$ cd osw/
- [oracle@cntlxxx osw]$ ls -lrt
- total 6172
- -rw-r--r-- 1 oracle oinstall 6318080 Dec 11 10:51 oswbb733.tar
解压包里包含了所有涉及到的shell脚本,tar解压后可直接使用
- [oracle@cntl202 osw]$ tar xvf oswbb733.tar
- oswbb/
- oswbb/docs/
- oswbb/docs/The_Analyzer/
- oswbb/docs/The_Analyzer/OSWatcherAnalyzerOverview.pdf
- ...(省略部分)...
- oswbb/src/
- oswbb/src/Thumbs.db
- oswbb/src/OSW_profile.htm
- oswbb/src/tombody.gif
- oswbb/src/missing_graphic.gif
- oswbb/src/coe_logo.gif
- oswbb/src/watch.gif
- oswbb/src/oswbba_input.txt
- oswbb/oswrds.sh
- [oracle@cntl202 osw]$
- [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下)
下面是启动脚本 参数说明
- [oracle@cntl202 oswbb]$ more startOSWbb.sh
- #!/bin/sh
-
- ######################################################################
- # Copyright (c) 2005 by Oracle Corporation
- # startOSW.sh
- # This is the script that starts the OSWatcher program. It accepts 4
- # arguments which control the frequency that data is collected and the
- # number of hours worth of data to archive.
- #
- # $1 = snapshot interval in seconds.
- # $2 = the number of hours of archive data to store.
- # $3 = (optional) the name of the zip or compress utility you want
- # OSWbb to use to zip up the archive files upon completion. If
- # no zipping is desired set this parameter = NONE. This will
- # allow for the $4 parameter below to be recognized as both $3
- # and $4 are optional parameters.
- # $4 = (optional) the fully qualified name of the archive directory
- # where you want oswbb to save your data. This option can be used
- # instead of setting the UNIX environment variable OSWBB_ARCHIVE_DEST
- # If this parameter is not set oswbb will look for the UNIX
- # environment variable OSWBB_ARCHIVE_DEST. If neither are set
- # the archive directory will remain in the default location under
- # the oswbb 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.
- ######################################################################
下面我们尝试启动程序。(收集间隔60秒,持续1小时,gzip压缩,数据存放在/home/oracle/osw/oswbb/archive下)
- [oracle@cntl202 oswbb]$ ./startOSWbb.sh 60 1 gzip /home/oracle/osw/oswbb/archive
- [oracle@cntl202 oswbb]$ Info...Zip option IS specified.
- Info...OSW will use gzip to compress files.
-
- Testing for discovery of OS Utilities...
- VMSTAT found on your system.
- IOSTAT found on your system.
- MPSTAT found on your system.
- IFCONFIG found on your system.
- 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 = 2
-
- Discovery completed.
-
- Starting OSWatcher v7.3.3 on Fri Dec 11 11:22:46 CST 2015
- With SnapshotInterval = 60
- With ArchiveInterval = 1
-
- 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 Carl.Davis@Oracle.com
-
- Data is stored in directory: /home/oracle/osw/oswbb/archive
-
- Starting Data Collection...
-
--osw开始收集
- oswbb heartbeat:Fri Dec 11 11:22:51 CST 2015
- oswbb heartbeat:Fri Dec 11 11:23:51 CST 2015
- oswbb heartbeat:Fri Dec 11 11:24:51 CST 2015
- oswbb heartbeat:Fri Dec 11 11:25:51 CST 2015
- oswbb heartbeat:Fri Dec 11 11:26:51 CST 2015
观察后台进程
- [oracle@cntl202 oswbb]$ ps -ef|grep osw
- oracle 3819 1 0 11:22 pts/0 00:00:00 /bin/sh ./OSWatcher.sh 60 1 gzip /home/oracle/osw/oswbb/archive
- 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目录下
- [oracle@cntl202 archive]$ ls -lrt
- total 40
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswprvtnet
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswvmstat
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswmpstat
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswnetstat
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswiostat
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswifconfig
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswtop
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswps
- drwxr-xr-x 2 oracle oinstall 4096 Dec 11 11:20 oswslabinfo
- 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收集方法
- [oracle@cntl202 oswbb]$ java -jar oswbba.jar -i /home/oracle/osw/oswbb/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 cntl202_iostat_15.12.11.1100.dat ...
-
-
- Parsing file cntl202_vmstat_15.12.11.1100.dat ...
-
-
- Parsing file cntl202_netstat_15.12.11.1100.dat ...
-
-
- Parsing file cntl202_top_15.12.11.1100.dat ...
-
-
- Parsing file cntl202_ps_15.12.11.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
4、结论
OS Watcher及其分析工具,是非常方便的性能监控程序。在很多场合下,结合数据库原有的AWR报告,可以让我们更加全面的了解系统瓶颈,优化系统。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17086096/viewspace-1870433/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/17086096/viewspace-1870433/