OSWatcher Black Box,简称OSW,是oracle提供的一个小但是非常有用的工具,它通过调用OS自己提供的命令来记录OS运行时的一些性能参数,比如cpu/Memory/Swap/Network IO/disk IO相关的信息。
但是部署OSW有很多好处:
1.它比较容易部署,并且容易删除。
2.资源消耗比较小,不管是从cpu,内存还是磁盘空间来说。
3.平时不需要维护,并且在发生问题时可以帮我们迅速定位问题是否发生在OS端
数据库是运行在OS之上的,如果OS发生了异常,那么数据库肯定也会受到影响;如果我们仅仅从数据库的角度去分析这样的问题时,很难有个好结果.
官方博客介绍如下:
1、下载
从MOS上里的文档301137.1上下载OSW,需要有MOS账号
百度网盘:http://pan.baidu.com/s/1bYdzJ4
2、安装
随便找一个目录解压安装,不要在/tmp目录,不必须root用户
[oracle@rhel6~]$mkdiroswatcher [oracle@rhel6~]$mvoswbb734.Taroswatcher/ [oracle@rhel6~]$cdoswatcher/ [oracle@rhel6oswatcher]$ls oswbb734.tar [oracle@rhel6oswatcher]$tar-xvfoswbb734.tar oswbb/ oswbb/call_uptime.sh oswbb/profile/ oswbb/analysis/ oswbb/tar_up_partial_archive.sh oswbb/oswsub.sh oswbb/oswrds.sh oswbb/src/ oswbb/src/missing_graphic.gif oswbb/src/tombody.gif oswbb/src/coe_logo.gif oswbb/src/Thumbs.db oswbb/src/OSW_profile.htm oswbb/src/oswbba_input.txt oswbb/src/watch.gif oswbb/oswib.sh oswbb/call_du.sh oswbb/tarupfiles.sh oswbb/ltop.sh oswbb/nfssub.sh oswbb/docs/ oswbb/docs/OSWatcher/ oswbb/docs/OSWatcher/OSWatcherUserGuide.pdf oswbb/docs/OSWatcher/oswbb_README.txt oswbb/docs/The_Analyzer/ oswbb/docs/The_Analyzer/oswbba_README.txt oswbb/docs/The_Analyzer/oswbbaUserGuide.pdf oswbb/docs/The_Analyzer/OSWatcherAnalyzerOverview.pdf oswbb/OSWatcher.sh oswbb/psmemsub.sh oswbb/call_sar.sh oswbb/oswnet.sh oswbb/Exampleprivate.net oswbb/mpsub.sh oswbb/Example_extras.txt oswbb/OSWatcherFM.sh oswbb/startOSWbb.sh oswbb/ifconfigsub.sh oswbb/iosub.sh oswbb/oswbba.jar oswbb/vmsub.sh oswbb/xtop.sh oswbb/stopOSWbb.sh
OSWatcher包含两部分:
oswbb:这是一个shell脚本,用于收集和存储数据
oswbba:这是一个java工具用于分析收集到的数据并提供建议,还可以生成图片或html文档。
3、启动OSWatcher
startOSWbb.sh脚本有四个参数:
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.
如果不输入任何参数,默认间隔30秒收集一次数据,并且默认保存48小时的数据。
默认收集到的数据会存储在解压目录下的archive目录下,这个目录是在第一次启动startOSWbb.sh脚本时创建的。
#启动startOSWbb.sh脚本,间隔15秒,保存5天的数据 [oracle@rhel6oswbb]$nohupshstartOSWbb.sh15120& [1]3131 [oracle@rhel6oswbb]$nohup:ignoringinputandappendingoutputto`nohup.out' [1]+DonenohupshstartOSWbb.sh15120 #查看输出日志 [oracle@rhel6oswbb]$morenohup.out Settingthearchivelogdirectoryto/home/oracle/oswatcher/oswbb/archive TestingfordiscoveryofOSUtilities... VMSTATfoundonyoursystem. IOSTATfoundonyoursystem. MPSTATfoundonyoursystem. IFCONfigfoundonyoursystem. NETSTATfoundonyoursystem. TOPfoundonyoursystem. TestingfordiscoveryofOScpuCOUNT oswbbislookingforthecpuCOUNTonyoursystem cpuCOUNtwillbeusedbyoswbbatoautomaticallylookforcpuproblems cpuCOUNTfoundonyoursystem. cpuCOUNT=2 discoverycompleted. #生成的archive目录下生成了对应不同收集信息的目录 [oracle@rhel6oswbb]$cdarchive [oracle@rhel6archive]$ls oswifconfigoswiostatoswmeminfooswmpstatoswnetstatoswprvtnetoswpsoswslabinfooswtoposwvmstat
MOS文档 ID 1531223.1有详细的介绍各个目录的含义。
4、分析OSWatcher收集到的日志
使用oswbba.jar包进行日志的分析,但是jara要在1.4.2及以上版本。
两种方法分析数据
1)生成图形
[oracle@rhel6oswbb]$exportdisPLAY=192.168.56.1:0.0 [oracle@rhel6oswbb]$java-jaroswbba.jar-iarchive StartingOSWAnalyzerV7.3.3 OSWatcherAnalyzerWrittenbyOracleCenterofExpertise copyright(c)2014byOracleCorporation ParsingData.PleaseWait... Scanningfileheadersforversionandplatforminfo... Parsingfilerhel6_iostat_16.12.19.1100.dat... Parsingfilerhel6_vmstat_16.12.19.1100.dat... Parsingfilerhel6_netstat_16.12.19.1100.dat... Parsingfilerhel6_top_16.12.19.1100.dat... Parsingfilerhel6_ps_16.12.19.1100.dat... ParsingCompleted. Enter1todisplaycpuProcessQueueGraphs Enter2todisplaycpuutilizationGraphs Enter3todisplaycpuOthergraphs Enter4todisplayMemoryGraphs Enter5todisplaydiskIOGraphs Enter6toGenerateallcpuGifFiles Enter7toGenerateallMemoryGifFiles Enter8toGeneratealldiskGifFiles EnterLtoSpecifyAlternateLocationofGifDirectory EnterTtoAltergraphTimeScaleOnly(Doesnotchangeanalysisdataset) EnterDtoReturntoDefaultGraphTimeScale EnterRtoRemoveCurrentlydisplayedGraphs EnteratoAnalyzeData EnterStoAnalyzeSubsetofData(Changesanalysisdatasetincludinggraphtimescale) EnterPtoGenerateAProfile EnterXtoExportParsedDatatoFile EnterQtoQuitProgram PleaseSelectanoption:7 Generatingfilegif/Dec19110157_1482117313/OSWg_OS_Memory_Swap.gif Generatingfilegif/Dec19110157_1482117313/OSWg_OS_Memory_Free.gif Generatingfilegif/Dec19110157_1482117313/OSWg_OS_Memory_Page_In_Rate.gif
2)生成报告
[oracle@rhel6oswbb]$java-jaroswbba.jar-iarchive-A Scanningfileheadersforversionandplatforminfo... Parsingfilerhel6_iostat_16.12.19.1100.dat... Parsingfilerhel6_vmstat_16.12.19.1100.dat... Parsingfilerhel6_netstat_16.12.19.1100.dat... Parsingfilerhel6_top_16.12.19.1100.dat... Parsingfilerhel6_ps_16.12.19.1100.dat... Datesaccepted.Verifyingvalidbegin/enddatapoints... Validatingtimesinthearchive... Recalibratingdata... Scanningfileheadersforversionandplatforminfo... Parsingfilerhel6_iostat_16.12.19.1100.dat... Parsingfilerhel6_vmstat_16.12.19.1100.dat... Parsingfilerhel6_netstat_16.12.19.1100.dat... Parsingfilerhel6_top_16.12.19.1100.dat... Parsingfilerhel6_ps_16.12.19.1100.dat... Anewanalysisfileanalysis/rhel6_1482117679897.txthasbeencreated. #生成的分析报告在analysis目录中 [oracle@rhel6oswbb]$moreanalysis/rhel6_1482117679897.txt Thisreportisbestviewedinafixedfonteditorliketextpad... OSWatcherAnalyzer InputArchive:archive ArchiveSourceDest:/home/oracle/oswatcher/oswbb/archive ArchiveStartTime:Dec1911:01:572016 ArchiveStopTime:Dec1911:20:592016 Hostname:RHEL6 Osversion:Linux SnapshotFreq:15 cpuCOUNT:2 ...... SubsystemStatus ------------------------ cpuOK MEMORYOK I/OWARNING NetoK ......
MOS文档ID 461053.1有详细介绍使用分析工具。