• 安装使用Oracle OSWbb/OSWbba工具



    OSWbb是收集数据,OSWbba 是分析数据,在OSWbb4.0以后,OSWbba已经绑定在OSWbb内。

    1.创建目录,上传/解压安装包

    [oracle@std ~]$ mkdir oswbb
    [oracle@std ~]$ mv oswbb732.tar oswbb
    [oracle@std ~]$ cd oswbb/
    [oracle@std oswbb]$ ls
    oswbb732.tar
    oracle@std oswbb]$ tar -xvf oswbb732.tar 
    oswbb/
    oswbb/data/
    oswbb/docs/
    oswbb/docs/The_Analyzer/
    oswbb/docs/The_Analyzer/OSWatcherAnalyzerOverview.pdf
    oswbb/docs/The_Analyzer/oswbbaUserGuide.pdf
    oswbb/docs/The_Analyzer/oswbba_README.txt
    oswbb/docs/OSWatcher/
    oswbb/docs/OSWatcher/oswbb_README.txt
    oswbb/docs/OSWatcher/OSWatcherUserGuide.pdf
    oswbb/Exampleprivate.net
    oswbb/nfssub.sh
    oswbb/stopOSWbb.sh
    oswbb/call_du.sh
    oswbb/iosub.sh
    oswbb/profile/
    oswbb/OSWatcherFM.sh
    oswbb/ifconfigsub.sh
    oswbb/ltop.sh
    oswbb/mpsub.sh
    oswbb/call_uptime.sh
    oswbb/gif/
    oswbb/psmemsub.sh
    oswbb/tar_up_partial_archive.sh
    oswbb/oswnet.sh
    oswbb/vmsub.sh
    oswbb/call_sar.sh
    oswbb/oswib.sh
    oswbb/startOSWbb.sh
    oswbb/Example_extras.txt
    oswbb/oswsub.sh
    oswbb/analysis/
    oswbb/oswbba.jar
    oswbb/locks/
    oswbb/tmp/
    oswbb/OSWatcher.sh
    oswbb/topaix.sh
    oswbb/tarupfiles.sh
    oswbb/xtop.sh
    oswbb/src/
    oswbb/src/Thumbs.db
    oswbb/src/OSW_profile.htm
    oswbb/src/tombody.gif
    oswbb/src/missing_graphic.gif
    oswbb/src/coe_logo.gif
    oswbb/src/watch.gif
    oswbb/src/oswbba_input.txt
    oswbb/oswrds.sh
    [oracle@std oswbb]$ ls
    oswbb  oswbb732.tar

    OSWBB目录结构

    [oracle@std oswbb]$ tree
    .
    |-- Example_extras.txt
    |-- Exampleprivate.net
    |-- OSWatcher.sh
    |-- OSWatcherFM.sh
    |-- analysis
    |-- call_du.sh
    |-- call_sar.sh
    |-- call_uptime.sh
    |-- data
    |-- docs
    |   |-- OSWatcher
    |   |   |-- OSWatcherUserGuide.pdf
    |   |   `-- oswbb_README.txt
    |   `-- The_Analyzer
    |       |-- OSWatcherAnalyzerOverview.pdf
    |       |-- oswbbaUserGuide.pdf
    |       `-- oswbba_README.txt
    |-- gif
    |-- ifconfigsub.sh
    |-- iosub.sh
    |-- locks
    |-- ltop.sh
    |-- mpsub.sh
    |-- nfssub.sh
    |-- oswbba.jar
    |-- oswib.sh
    |-- oswnet.sh
    |-- oswrds.sh
    |-- oswsub.sh
    |-- profile
    |-- psmemsub.sh
    |-- src
    |   |-- OSW_profile.htm
    |   |-- Thumbs.db
    |   |-- coe_logo.gif
    |   |-- missing_graphic.gif
    |   |-- oswbba_input.txt
    |   |-- tombody.gif
    |   `-- watch.gif
    |-- startOSWbb.sh
    |-- stopOSWbb.sh
    |-- tar_up_partial_archive.sh
    |-- tarupfiles.sh
    |-- tmp
    |-- topaix.sh
    |-- vmsub.sh
    `-- xtop.sh

    2.启动OSWbb

    启动 OSWbb 实用程序,可以直接在 OSWbb 的安装目录下执行 startOSWbb.sh shell 脚本, 

     该脚本一共有4个参数,其中两个为可选参数,他们分别是:

    $1 = 快照间隔,以秒为单位。

    $2 = 要存储的归档数据的小时数。

    $3 = (可选)压缩工具的名称,可以自动将生成的文件进行压缩。

    $4 = (可选)保存归档的非默认路径,改参数用于替换OSWBB_ARCHIVE_DEST环境变量,

    如果不设置这个参数oswbb将寻找环境变量OSWBB_ARCHIVE_DEST。 如果都没有设置的话,就会用默认的归档目录

    示例 1:不输入任何参数启动时,则会以 30 秒间隔来收集数据,将每个小时的数据记录到一个归档文件,并自动删除48小时前的归档文件

    ./startOSWbb.sh

    示例 2:这将启动时,以 60 秒间隔来收集数据,将每个小时的数据记录到一个归档文件,自动删除10小时前的归档文件,并且自动压缩文件。

    ./startOSWbb.sh 60 10 gzip

    示例 3:这将启动时,以 60 秒间隔来收集数据,将每个小时的数据记录到一个归档文件,自动删除10小时前的归档文件,自动压缩文件,并且保存到一个非默认路径下。

    ./startOSWbb.sh 60 10 gzip /u02/tools/oswbb/archive

    示例 5:以nohup启动时,将进程置于后台运行,允许工具在会话被终止后继续运行,以 60 秒间隔收集数据,将每个小时的数据记录到一个归档文件, 并自动删除10小时前的归档文件。

    nohup ./startOSWbb.sh 60 10 &

    注意

    启动oswbb之前必须设置OS的LANG环境变量为英文环境,要不然oswbba的时候无法分析

    ~]# export LANG=zh_US

    ~]# date         #通过date的输出结果,查看语言环境

    Fri Jan  3 20:56:15 CST 2014

    [oracle@std oswbb]$ ./startOSWbb.sh 60 10 gzip /home/oracle/oswbb/archive/
    [oracle@std oswbb]$ Info...Zip option IS specified. 
    Info...OSW will use gzip to compress files.
    
    Testing for discovery of OS Utilities...
    VMSTAT found on your system.
    IOSTAT found on your system.
    MPSTAT found on your system.
    Warning... IFCONFIG not found on your system. No IFCONFIG data will be collected.  --因为我们是普通用户执行的,直接执行ifconfig会找不到该命令 /sbin/ifconfig
    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.
    
    Starting OSWatcher Black Box v7.3.2  on Wed Jan 27 11:30:44 CST 2016
    With SnapshotInterval = 60
    With ArchiveInterval = 10
    
    OSWatcher Black Box - Written by Carl Davis, Center of Expertise,
    Oracle Corporation
    For questions on install/usage please go to MOS (Note:301137.1)
    If you need further assistance or have comments or enhancement
    requests you can email me Carl.Davis@Oracle.com
    
    Data is stored in directory: /home/oracle/oswbb/archive/
    
    Starting Data Collection...
    
    oswbb heartbeat:Wed Jan 27 11:30:49 CST 2016
    oswbb heartbeat:Wed Jan 27 11:31:49 CST 2016
    oswbb heartbeat:Wed Jan 27 11:32:49 CST 2016
    oswbb heartbeat:Wed Jan 27 11:33:49 CST 2016
    [oracle@std oswbb]$ ll archive/
    total 40
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswifconfig
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswiostat
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswmeminfo
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswmpstat
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswnetstat
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswprvtnet
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswps
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswslabinfo
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswtop
    drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswvmstat

    查看收集到的数据样例:

    [oracle@std archive]$ cd oswiostat/
    [oracle@std oswiostat]$ ls
    std_iostat_16.01.27.1100.dat
    [oracle@std oswiostat]$ cat std_iostat_16.01.27.1100.dat 
    Linux OSWbb v7.3.2
    zzz ***Wed Jan 27 11:30:49 CST 2016
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               1.02    0.00    1.02    0.51    0.00   97.46
    
    Device:         rrqm/s   wrqm/s   r/s   w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
    sda               0.00     0.00  4.00  0.00    52.00     0.00    26.00     0.02    4.75   4.75   1.90
    sda1              0.00     0.00  4.00  0.00    52.00     0.00    26.00     0.02    4.75   4.75   1.90
    sda2              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    
    zzz ***Wed Jan 27 11:31:49 CST 2016
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               0.51    0.00    1.52   14.21    0.00   83.76
    
    Device:         rrqm/s   wrqm/s   r/s   w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
    sda               0.00    82.00  0.00 22.00     0.00   484.00    44.00     0.96   45.00  12.95  28.50
    sda1              0.00    82.00  0.00 22.00     0.00   484.00    44.00     0.96   45.00  12.95  28.50
    sda2              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    
    zzz ***Wed Jan 27 11:32:49 CST 2016
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               0.51    0.00    1.01    0.00    0.00   98.48
    
    Device:         rrqm/s   wrqm/s   r/s   w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
    sda               0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    sda1              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    sda2              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    
    zzz ***Wed Jan 27 11:33:49 CST 2016
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
               0.50    0.00    1.51    1.51    0.00   96.48
    
    Device:         rrqm/s   wrqm/s   r/s   w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
    sda               0.00     6.00  0.00  2.00     0.00    32.00    32.00     0.03   14.50  14.50   2.90
    sda1              0.00     6.00  0.00  2.00     0.00    32.00    32.00     0.03   14.50  14.50   2.90
    sda2              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

    4.停止oswbb

    [oracle@std oswbb]$ ./stopOSWbb.sh 
    [oracle@std oswbb]$ ps -ef|grep oswbb |grep -v grep

    5.后台启动oswbb

    [oracle@std oswbb]$ nohup ./startOSWbb.sh 60 10 gzip /home/oracle/oswbb/archive/ 2 >&1 > /home/oracle/oswbb/oswbb.log &
    [1] 1151
    [oracle@std oswbb]$ tail -f ../oswbb.log 
    Oracle Corporation
    For questions on install/usage please go to MOS (Note:301137.1)
    If you need further assistance or have comments or enhancement
    requests you can email me Carl.Davis@Oracle.com
    
    Data is stored in directory: /home/oracle/oswbb/archive/
    
    Starting Data Collection...
    
    oswbb heartbeat:Wed Jan 27 13:54:57 CST 2016
    oswbb heartbeat:Wed Jan 27 13:55:57 CST 2016
    解释一下 2 >&1 
    
    在 shell 程式中,最常使用的 FD (file descriptor) 大概有三个, 分别是:
    
    0 是一个文件描述符,表示标准输入(stdin)
    1 是一个文件描述符,表示标准输出(stdout)
    2 是一个文件描述符,表示标准错误(stderr)
    
    在标准情况下, 这些FD分别跟如下设备关联: 
    stdin(0): keyboard 键盘输入,并返回在前端 
    stdout(1): monitor 正确返回值 输出到前端 
    stderr(2): monitor 错误返回值 输出到前端
    
    
    & 是一个描述符,如果1或2前不加&,会被当成一个普通文件
    1>&2 意思是把标准输出重定向到标准错误.
    2>&1 意思是把标准错误输出重定向到标准输出。
    &>filename 意思是把标准输出和标准错误输出都重定向到文件filename中

    6.owsbba(OS Watcher Black Box Analyzer)分析抓取的数据

    我们用OSWatcher 收集了数据存储到归档里,但是这些文件不利于分析,
    所以Oracle 提供了OSWbba(OS Watcher Black Box Analyzer)工具,
    其可以分析OSWbb收集的数据并用图表展示出来。

    --查看java版本

    [oracle@std ~]$ java -version
    java version "1.4.2"
    gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)

    我们的版本过低,更新JDK环境

    [oracle@std ~]$ java -version
    java version "1.7.0_25"
    Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
    Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode)

     --启动oswbba

    [oracle@std ~]$ su - 
    Password: 
    [root@std ~]# DISPLAY=192.168.1.210:0.0
    [root@std ~]# xhost +
    access control disabled, clients can connect from any host
    [root@std ~]# exit
    logout
    [oracle@std ~]$ java -jar /home/oracle/oswbb/oswbb/oswbba.jar -i /home/oracle/oswbb/archive/
    
    Starting OSW Analyzer V7.3.1
    OSWatcher Analyzer Written by Oracle Center of Expertise
    Copyright (c)  2014 by Oracle Corporation
    
    Parsing Data. Please Wait...
    
    
    WARNING. oswbba has detected at least some of the files in you  
    archive have been compressed. These files will not be analyzed. 
    You must uncompress all the files in the archive for full 
    analysis and graphing capabilities.
    
    Scanning file headers for version and platform info...
    
    Compressed file found. Ignoring  std_iostat_16.01.27.1100.dat.gz ...
    Compressed file found. Ignoring  std_iostat_16.01.27.1300.dat.gz ...
    
    Compressed file found. Ignoring  std_iostat_16.01.27.1100.dat.gz ...
    Parsing file std_iostat_16.01.27.1200.dat ...
    Compressed file found. Ignoring  std_iostat_16.01.27.1300.dat.gz ...
    Parsing file std_iostat_16.01.27.1400.dat ...
    
    
    Compressed file found. Ignoring  std_vmstat_16.01.27.1100.dat.gz ...
    Parsing file std_vmstat_16.01.27.1200.dat ...
    Compressed file found. Ignoring  std_vmstat_16.01.27.1300.dat.gz ...
    Parsing file std_vmstat_16.01.27.1400.dat ...
    
    
    Compressed file found. Ignoring  std_netstat_16.01.27.1100.dat.gz ...
    Parsing file std_netstat_16.01.27.1200.dat ...
    Compressed file found. Ignoring  std_netstat_16.01.27.1300.dat.gz ...
    Parsing file std_netstat_16.01.27.1400.dat ...
    
    
    Compressed file found. Ignoring  std_top_16.01.27.1100.dat.gz ...
    Parsing file std_top_16.01.27.1200.dat ...
    Compressed file found. Ignoring  std_top_16.01.27.1300.dat.gz ...
    Parsing file std_top_16.01.27.1400.dat ...
    
    
    Compressed file found. Ignoring  std_ps_16.01.27.1100.dat.gz ...
    Parsing file std_ps_16.01.27.1200.dat ...
    Compressed file found. Ignoring  std_ps_16.01.27.1300.dat.gz ...
    Parsing file std_ps_16.01.27.1400.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:4
    
    
    
    
    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:

    在解压后的oswbb/docs中可以查看官方帮助文档。

    参考:
    http://www.dbaydna.com/oswatcher%E5%9C%A8linux%E7%8E%AF%E5%A2%83%E4%BD%BF%E7%94%A8.html
    http://www.cnblogs.com/kaituorensheng/p/3980334.html
    http://blog.itpub.net/27000195/viewspace-1415841/

  • 相关阅读:
    地理学考 要结合地图记忆的知识点
    物理选修3-1学习笔记
    UOJ#506. 【JOISC2020】遗迹 动态规划
    UOJ#39. 【清华集训2014】简单回路 动态规划 插头DP
    UOJ#339. 【清华集训2017】小 Y 和二叉树 贪心
    Codeforces 1239E. Turtle 折半
    概率论学习笔记
    UOJ#469. 【ZJOI2019】开关 生成函数
    被鄙视
    UOJ#468. 【ZJOI2019】Minimax搜索 动态DP
  • 原文地址:https://www.cnblogs.com/myrunning/p/5163289.html
Copyright © 2020-2023  润新知