OSWatcher使用简介
admin
2023-04-29 21:23:40
0

   OSWatcher Black Box, 简称OSW,是oracle提供的一个小但是非常有用的工具,它通过调用OS自己提供的命令来记录OS运行时的一些性能参数,比如CPU/Memory/Swap/Network IO/Disk IO相关的信息。

但是部署OSW有很多好处:

1. 它比较容易部署,并且容易删除。
2. 资源消耗比较小,不管是从CPU,内存还是磁盘空间来说。
3. 平时不需要维护,并且在发生问题时可以帮我们迅速定位问题是否发生在OS端

数据库是运行在OS之上的,如果OS发生了异常,那么数据库肯定也会受到影响;如果我们仅仅从数据库的角度去分析这样的问题时,很难有个好结果.

官方博客介绍如下:

https://blogs.oracle.com/Database4CN/entry/%E5%88%A9%E5%99%A8osw_oswatcher_black_box_%E4%B9%8B%E7%AE%80%E4%BB%8B%E7%AF%87

1、下载

从MOS上里的文档301137.1上下载OSW,需要有MOS账号

百度网盘:http://pan.baidu.com/s/1bYdzJ4

2、安装

随便找一个目录解压安装,不要在/tmp目录,不必须root用户

[oracle@rhel6 ~]$ mkdir oswatcher
[oracle@rhel6 ~]$ mv oswbb734.tar oswatcher/
[oracle@rhel6 ~]$ cd oswatcher/
[oracle@rhel6 oswatcher]$ ls
oswbb734.tar
[oracle@rhel6 oswatcher]$ tar -xvf oswbb734.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@rhel6 oswbb]$ nohup sh startOSWbb.sh 15 120 &
[1] 3131
[oracle@rhel6 oswbb]$ nohup: ignoring input and appending output to `nohup.out'

[1]+  Done                    nohup sh startOSWbb.sh 15 120
#查看输出日志
[oracle@rhel6 oswbb]$ more nohup.out 
Setting the archive log directory to/home/oracle/oswatcher/oswbb/archive

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.
#生成的archive目录下生成了对应不同收集信息的目录
[oracle@rhel6 oswbb]$ cd archive
[oracle@rhel6 archive]$ ls
oswifconfig  oswiostat  oswmeminfo  oswmpstat  oswnetstat  oswprvtnet  oswps  oswslabinfo  oswtop  oswvmstat

MOS文档 ID 1531223.1有详细的介绍各个目录的含义。

在OSWbb第一次使用时,它会创建一些归档的子目录。 这些归档目录包含7个子目录,每一个子目录对应一个收集数据。 这7个目录分别对应:top, vmstat, iostat, mpstat, netstat, ps 和一个可选的traceprivate network。

要启动private network,必须先在oswbb目录下创建一个private.net的可执行文件。 这个文件里的内容可以是用来验证RAC private network的traceroute命令,不同平台使用traceroute命令的参数不尽相同,private.net文件可以可以根据Exampleprivate.net文件来修改创建。

HP-UX的一个例子

######################################################################
#HP Example
######################################################################
echo "zzz ***"`date`
traceroute -r -F 192.168.2.21
traceroute -r -F 192.168.2.22
######################################################################
# DO NOT DELETE THE FOLLOWING LINE!!!!!!!!!!!!!!!!!!!!!
######################################################################
rm locks/lock.file

4、分析OSWatcher收集到的日志

使用oswbba.jar包进行日志的分析,但是jara要在1.4.2及以上版本。

两种方法分析数据

1)生成图形

[oracle@rhel6 oswbb]$ export DISPLAY=192.168.56.1:0.0
[oracle@rhel6 oswbb]$ java -jar oswbba.jar -i 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 rhel6_iostat_16.12.19.1100.dat ...


Parsing file rhel6_vmstat_16.12.19.1100.dat ...


Parsing file rhel6_netstat_16.12.19.1100.dat ...


Parsing file rhel6_top_16.12.19.1100.dat ...


Parsing file rhel6_ps_16.12.19.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

Please Select an Option:7
Generating file gif/Dec19110157_1482117313/OSWg_OS_Memory_Swap.gif
Generating file gif/Dec19110157_1482117313/OSWg_OS_Memory_Free.gif
Generating file gif/Dec19110157_1482117313/OSWg_OS_Memory_Page_In_Rate.gif

OSWatcher使用简介

2)生成报告

[oracle@rhel6 oswbb]$ java -jar oswbba.jar -i archive -A
Scanning file headers for version and platform info...


Parsing file rhel6_iostat_16.12.19.1100.dat ...


Parsing file rhel6_vmstat_16.12.19.1100.dat ...


Parsing file rhel6_netstat_16.12.19.1100.dat ...


Parsing file rhel6_top_16.12.19.1100.dat ...


Parsing file rhel6_ps_16.12.19.1100.dat ...


Dates accepted. Verifying valid begin/end data points...

Validating times in the archive...


Recalibrating data...
Scanning file headers for version and platform info...


Parsing file rhel6_iostat_16.12.19.1100.dat ...


Parsing file rhel6_vmstat_16.12.19.1100.dat ...


Parsing file rhel6_netstat_16.12.19.1100.dat ...


Parsing file rhel6_top_16.12.19.1100.dat ...


Parsing file rhel6_ps_16.12.19.1100.dat ...


A new analysis file analysis/rhel6_1482117679897.txt has been created.
#生成的分析报告在analysis目录中
[oracle@rhel6 oswbb]$ more analysis/rhel6_1482117679897.txt
This report is best viewed in a fixed font editor like textpad...

OSWatcher Analyzer

Input Archive:       archive
Archive Source Dest: /home/oracle/oswatcher/oswbb/archive
Archive Start Time:  Dec 19 11:01:57 2016
Archive Stop Time:   Dec 19 11:20:59 2016
Hostname:            RHEL6
OS Version:          Linux
Snapshot Freq:       15
CPU COUNT:           2
......
Subsystem       Status
------------------------
CPU             OK
MEMORY          OK
I/O             WARNING 
NET             OK
......

MOS文档 ID 461053.1有详细介绍使用分析工具。

相关内容

热门资讯

烈焰熊熊,堪比“原子弹”,欧洲... 据美国有线电视新闻网(CNN)7月29日报道,席卷法国西南部的大片野火燃烧得如此猛烈,以至于形成了一...
外交部:对日本熊本县地震遇难者... 据凤凰卫视报道,针对日本熊本县发生强震造成人员伤亡,中国外交部发言人毛宁7月29日在例行记者会上表示...
高铁喧哗被劝阻后叫嚣全家体制内... “女子高铁喧哗被劝阻后叫嚣全家体制内”一事迎来官方通报。据新京报报道,7月29日,辽宁北票市公安局发...
广东专业蓝牙耳机定制厂家推荐,... 在珠三角腹地,广东早已成为全球蓝牙耳机产业链的“心脏地带”。从深圳华强北的声学元件批发,到东莞、惠州...
格雷厄姆葬礼变地缘竞价场!两大... 有些葬礼,送别的是逝者;有些葬礼,演的却是活人最现实的政治博弈。当地时间7月28日,美国老牌鹰派参议...
一道小学数学题难住3名医学博士... 3名不同学校的博士同做一道数学题,谁最厉害?近日,一陕西网友发布的视频引发热议。29日,视频发布者“...
华为全新“小艺任务”亮相:整合... 7月29日,在华为鸿蒙电脑新品技术沟通会上,终端云服务小艺业务部总裁贾永利宣布,小艺将迎来“从对话到...
广西日报特稿《王的猜想》火了,... 澎湃新闻记者 蒋子文 实习生 汤煜炜为应对外界购买纸质版特稿《王的猜想》的热情,《广西日报》宣布紧急...
月租20元内!2026年平价云... 不少手游玩家、账号运营从业者挑选云手机时,首要诉求就是低价够用,想要控制每月支出在20元以内,同时兼...
诺奖得主如何看待王虹境遇?“我... 中村修二(2014年诺贝尔物理学奖得主)【导读】近日王虹与邓煜双双获得2026年菲尔兹奖,成为了首批...