阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

OSWatcher使用简介

126次阅读
没有评论

共计 5956 个字符,预计需要花费 15 分钟才能阅读完成。

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 账号

或者到 Linux 公社 1 号 FTP 服务器下载

—————————————— 分割线 ——————————————

FTP 地址:ftp://ftp1.linuxidc.com

用户名:ftp1.linuxidc.com

密码:www.linuxidc.com

在 2016 年 LinuxIDC.com\12 月 \OSWatcher 使用简介 \

下载方法见 http://www.linuxidc.com/Linux/2013-10/91140.htm

—————————————— 分割线 —————————————— 

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 有详细的介绍各个目录的含义。

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

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-12/138680.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计5956字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中