OSWatcher Black Box (oswbb)是Oracle开发、提供的一个小巧,但是实用、强大的系统工具,它可以用来抓取操作系统的性能指标,用于辅助监控系统的资源使用。其安装部署、卸载都非常简单;资源消耗也比较小,原理也十分简单,它通过调用OS的的一些命令(例如vmstat、iostat等)来采集、存储CPU/Memory/Swap/Disk IO/Nentwork相关数据。安装和运行oswbba可以帮助在性能诊断时提供丰富多样的各类性能数据、图文报表支持。
OSWatcher 在4.0的版本时被命名为OSWatcher Black Box,简称为oswbb,同时增加了数据分析功能,即OSWatcher Black Box Analyzer (OSWbba)这个绘图和分析工具,其捆绑在 OS Watcher Black Box当中。替代了之前的OSWg。 也就是说在OSWatcher 4.0 之前是:OSWatcher 和 OSWg的关系,OSWatcher 4.0 后变成了: OSWbb 与 OSWbba 的关系。
OSWatcher Black Box(oswbb)支持多个操作系统,也分Linux与Window版本,当然这两个版本有所差别,本篇只讲述Linux版本。另外,OSWatcher Black Box(oswbb)由两个部分组成:
oswbb: 一个Unix的 shell script脚本集合,其用来收集和归档数据,从而帮助定位问题。
oswbba: 一个Java工具来自动分析数据,提供建议,并且生成一个包含图形的 html 文档。
安装与卸载
软件安装
工具卸载
rm -rf oswbb
启动与停止
启动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 60 10 gzip /u01/soft/oswbb/archive
停止命令
./stopOSWbb.sh
分析OSWatcher收集到的日志
使用oswbba.jar包进行日志的分析,但是jara要在1.4.2及以上版本。
两种方法分析数据
1)生成图形
#cd /u01/oswatcher
#java -jar oswbba.jar -i /u01/oswatcher/archive/ -b May 3 00:00:00 2018 -e May 3 23:59:59 2018
[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
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
......