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有详细介绍使用分析工具。

相关内容

热门资讯

国台办:买再多的武器都是螳臂当... 5月13日,国务院台办举行例行新闻发布会。总台记者就台湾军购费用引发舆论质疑提问。发言人张晗表示,我...
豫篮联赛:赛场劲吹“文旅风” 汉服小姐姐在看台上翩翩起舞。胡斌 摄洛阳队球员上篮。胡斌 摄“五一”小长假后,豫篮联赛伴随着初夏的热...
凡星闪耀丨《武林外传》中小米扮... 张清(右)在免费餐厅为大家服务。张清在《武林外传》中饰演“丐帮弟子”小米(右)。在郑州的城市烟火气中...
卫华:做走向世界的“起重管家” 卫华集团智能生产车间。常晶晶 摄作为全省服务业大会的参会企业,河南卫华重型机械股份有限公司(以下简称...
在加快国际消费中心城市建设中彰... “服务业是推动经济高质量发展的重要引擎,也是强化国家中心城市核心竞争力的重要支柱。”5月12日,省委...
坚定不移沿着习近平总书记指引的... 壮美的郑州黄河文化公园。河南日报资料图片 河南日报全媒体记者 聂冬晗 摄来郑州,到哪里慢赏大河风光?...
双庆同辉映初心——黄河科技学院... 2026年5月12日,黄河科技学院附属医院迎来开诊七周年纪念日,恰逢第115个国际护士节。当天,医院...
驻美大使谢锋回应中美热点问题 据中国驻美国大使馆5月13日消息,5月5日,中国驻美国大使谢锋就美国总统特朗普访华和中美关系接受美国...
邻妹妹帮办 | 占地1.2万㎡... “杞县有个婚礼庄园,6 大主题特色宴会厅,可同时容纳2000人聚餐,在未变更工业用地用途、未经消防验...
国台办:和平统一后,台湾同胞民... 5月13日,国务院台办举行例行新闻发布会。有记者问,国务院台办发言人在之前发布会上已分别阐释了和平统...