当前位置: 首页 > article >正文

OSwatch性能分析工具部署

        

目录

1. OSwatch 安装

1.1. OSwatch 下载

1.2. 部署私网监控(可选,Rac 环境心跳中使用)

1.3. 新增 archive 目录

1.4. 启动 osw

1.4.1. crontab 启动脚本

1.5. OSW 生成文件查看

1.6. 关闭 osw

2. OSwatch 数据分析

2.1. 运行前首先检查 java 环境:

2.2. 在服务端准备图形界面

2.3. 分析日志

2.3.1. 报错解决

2.4. 查询分析的结果

2.4.1. Analyze Data

2.4.2. Generate All CPU Gif Files

OSWatcher Black Box, 简称OSW,是oracle提供的一个非常有用的操作系统性能分析工具,它通过调用OS自己提供的命令来记录OS运行时的一些性能参数,比如CPU/Memory/Swap/Network IO/Disk IO相关的信息。OSW的工作机制是每隔一段时间调用OS提供的一些工具,比如ps, vmstat, netstat, mpstat, top;然后把这些工具的输出打印到文件里,当系统出现问题时我们可以利用收集的信息帮助我们去分析问题。

OSWatcher支持以下平台:

AIX

Tru64

Solaris

HP-UX

Linux

Windows

1. OSwatch 安装

1.1. OSwatch 下载

下载 OSwatch ( mos 文档 ID 301137.1 )

网盘路径

通过网盘分享的文件:oswbb840.zip

链接: 百度网盘 请输入提取码

部署在/mysql/osw1/目录下

tar – xvf oswbb840.tar -d /mysql/osw1/

1.2. 部署私网监控(可选,Rac 环境心跳中使用)

在每个节点上,根据 exampleprivate.net 文件, 新增 private.net 文件

注意修改private.net权限为755

chmod 755 private.net

vi private.net

#!/bin/sh
#####################################################################
# This file contains examples of how to monitor private networks. To
# monitor your private networks create an executable file in this same
# directory named private.net. Use the example for your host os below.
# Make sure not to remove the last line in this file. Your file
# private.net MUST contain the rm lock.file line.
#####################################################################
#Solaris Example
#####################################################################
echo "zzz ***"`date`
traceroute -r -F hefei1-priv
traceroute -r -F hefei2-priv
#####################################################################
# DO NOT DELETE THE FOLLOWING LINE!!!!!!!!!!!!!!!!!!!!!
#####################################################################
rm locks/lock.file

1.3. 新增 archive 目录

OSWATCH V7.3.3 以后,如果不指定 archive 目录, osw 默认的 archive 目录为 /app/oracle/tfa/repository/suptools/db01/oswbb/grid/archive, 为了避免影响 /app 目录,建议手工指定 archive 目录。

创建 archive 目录并修改权限

mkdir /osw/oswbb/archive
chmod 775 /osw/oswbb/archive

1.4. 启动 osw

cd /mysql/osw1/oswbb840/oswbb
nohup /mysql/osw1/oswbb840/oswbb/startOSWbb.sh 5 720 gzip /osw/oswbb/archive >/osw/oswbb/startOSW.sh.out 2>&1 &

#其中 5 代表 5 秒收集一次 ,720 代表保留 720 小时 (可根据实际需求调整)。
#gzip /osw/oswbb/archive 代表文件压缩并指定存放位置。

startOSWbb.sh脚本有四个参数:

# $1 = snapshot interval in seconds. #快照收集的频率(秒)

# $2 = the number of hours of archive data to store. #归档数据保留的时间(小时)

# $3 = (optional) the name of the zip or compress utility you want #可选,用于在创建每个文件后自动压缩该文件的压缩实用程序的名称

# OSWbb to use to zip up the archive files upon completion. If

# no zipping is desired set this parameter = NONE. This will

# allow for the $4 parameter below to be recognized as both $3

# and $4 are optional parameters.

# $4 = (optional) the fully qualified name of the archive directory #可选,存储归档目录的备用(非默认)位置。 如果不输入任何参数,默认间隔30秒收集一次数据,并且默认保存48小时的数据。

# where you want oswbb to save your data. This option can be used

# instead of setting the UNIX environment variable OSWBB_ARCHIVE_DEST

# If this parameter is not set oswbb will look for the UNIX

# environment variable OSWBB_ARCHIVE_DEST. If neither are set

# the archive directory will remain in the default location under

# the oswbb directory

例: nohup ./startOSWbb.sh 15 120 gzip &

会每隔15秒搜集一次数据,将结果保留120 小时,并自动压缩生成的文件。

1.4.1. crontab 启动脚本

crontab -e
0,30 * * * * sh /mysql/osw1/oswbb840/oswbb/monosw.sh

vi monosw.sh
----------------------monosw.sh-----------------------------
#!/usr/bin/ksh 
if ps -ef | grep OSWatcher | grep -v grep > /dev/null; then
    echo "$(date): OSWatcher is running." >> /var/log/oswatcher.log
else
    echo "$(date): OSWatcher is not running. Starting..." >> /var/log/oswatcher.log
    sh "$(dirname "$0")/startOSWbb.sh"
fi

1.5. OSW 生成文件查看

1.6. 关闭 osw

/mysql/osw1/oswbb840/oswbb/stopOSWbb.sh

OR

ps -ef |grep OSW |grep -v grep
kill 9 sid

2. OSwatch 数据分析

2.1. 运行前首先检查 java 环境:

[root@db01 oswbb]# java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)

2.2. 在服务端准备图形界面

2.3. 分析日志

运行 OSWbba 需要用-i 参数指定 archive 目录,这里的目录是 archive 的绝对路径,需要注意的是,这里生成的图形是直接弹出来的,需要用 X Windows.

export LANG=en_US
java -jar /mysql/osw1/oswbb840/oswbb/oswbba.jar -i /mysql/osw1/oswbb840/oswbb/archive


[root@db01 oswbb]# java -jar /mysql/osw1/oswbb840/oswbb/oswbba.jar -i /mysql/osw1/oswbb840/oswbb/archive

Validating times in the archive...


Starting OSW Analyzer V9.0.9
Copyright (c)  2022 by Oracle Corporation

Parsing Data. Please Wait...

Scanning file headers for version and platform info...

Parsing file db01_prvtnet_25.02.08.1000.dat ...
Compressed file found. Ignoring  nohup.out ...

Parsing file db01_pidstat_25.02.08.0900.dat ...
Parsing file db01_pidstat_25.02.08.1000.dat ...

Parsing file db01_iostat_25.02.08.0900.dat ...
Parsing file db01_iostat_25.02.08.1000.dat ...

Parsing file db01_nfsiostat_25.02.08.0900.dat ...
Parsing file db01_nfsiostat_25.02.08.1000.dat ...
Parsing file db01_vmstat_25.02.08.0900.dat ...
Parsing file db01_vmstat_25.02.08.1000.dat ...

Parsing file db01_meminfo_25.02.08.0900.dat ...
Parsing file db01_meminfo_25.02.08.1000.dat ...

Parsing file db01_netstat_25.02.08.0900.dat ...
Parsing file db01_netstat_25.02.08.1000.dat ...

Parsing file db01_top_25.02.08.0900.dat ...
Parsing file db01_top_25.02.08.1000.dat ...


Parsing file db01_ps_25.02.08.0900.dat ...
Parsing file db01_ps_25.02.08.1000.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 61 to Display Individual OS Process I/O RPS Graphs
Enter 62 to Display Individual OS Process I/O WPS Graphs
Enter 63 to Display Individual OS Process Percent User CPU Graphs
Enter 64 to Display Individual OS Process Percent System CPU Graphs
Enter 65 to Display Individual OS Process Percent Total CPU (User + System) Graphs
Enter 66 to Display Individual OS Process Percent Memory Graphs

Enter GP to Generate Individual Process Profile
Enter GC to Generate All CPU Gif Files
Enter GM to Generate All Memory Gif Files
Enter GD to Generate All Disk Gif Files
Enter GN to Generate All Network Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter Z to Zoom Graph Time Scale (Does not change analysis dataset)
Enter B to Returns to Baseline Graph Time Scale (Does not change analysis dataset)
Enter R to Remove Currently Displayed Graphs

Enter X to Export Parsed Data to Flat File
Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale)
Enter A to Analyze Data
Enter D to Generate DashBoard

Enter Q to Quit Program

Please Select an Option:A
Enter a unique analysis directory name or enter <CR> to accept default name:

A new analysis file analysis/db01_Feb08090557_1738996931/analysis.txt has been created.


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 61 to Display Individual OS Process I/O RPS Graphs
Enter 62 to Display Individual OS Process I/O WPS Graphs
Enter 63 to Display Individual OS Process Percent User CPU Graphs
Enter 64 to Display Individual OS Process Percent System CPU Graphs
Enter 65 to Display Individual OS Process Percent Total CPU (User + System) Graphs
Enter 66 to Display Individual OS Process Percent Memory Graphs

Enter GP to Generate Individual Process Profile
Enter GC to Generate All CPU Gif Files
Enter GM to Generate All Memory Gif Files
Enter GD to Generate All Disk Gif Files
Enter GN to Generate All Network Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter Z to Zoom Graph Time Scale (Does not change analysis dataset)
Enter B to Returns to Baseline Graph Time Scale (Does not change analysis dataset)
Enter R to Remove Currently Displayed Graphs

Enter X to Export Parsed Data to Flat File
Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale)
Enter A to Analyze Data
Enter D to Generate DashBoard

Enter Q to Quit Program

Please Select an Option:GC
Generating file gif/Feb08090557_1738996938/OSWg_OS_Run_Queue.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Block_Queue.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Cpu_Idle.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Cpu_System.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Cpu_User.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Cpu_Wa.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Cpu_Interrupts.gif
Generating file gif/Feb08090557_1738996938/OSWg_OS_Context_Switches.gif
Files written to the gif/Feb08090557_1738996938 directory.

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 61 to Display Individual OS Process I/O RPS Graphs
Enter 62 to Display Individual OS Process I/O WPS Graphs
Enter 63 to Display Individual OS Process Percent User CPU Graphs
Enter 64 to Display Individual OS Process Percent System CPU Graphs
Enter 65 to Display Individual OS Process Percent Total CPU (User + System) Graphs
Enter 66 to Display Individual OS Process Percent Memory Graphs

Enter GP to Generate Individual Process Profile
Enter GC to Generate All CPU Gif Files
Enter GM to Generate All Memory Gif Files
Enter GD to Generate All Disk Gif Files
Enter GN to Generate All Network Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter Z to Zoom Graph Time Scale (Does not change analysis dataset)
Enter B to Returns to Baseline Graph Time Scale (Does not change analysis dataset)
Enter R to Remove Currently Displayed Graphs

Enter X to Export Parsed Data to Flat File
Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale)
Enter A to Analyze Data
Enter D to Generate DashBoard

Enter Q to Quit Program

Please Select an Option:Q
[root@db01 oswbb]#

2.3.1. 报错解决

--报错:Exception in thread "main" java.lang.NullPointerException

at o.b(Unknown Source)

at B.a(Unknown Source)

at o.a(Unknown Source)

at OSWGraph.OSWGraph.main(Unknown Source)

--解决:
yum -y install *vnc*
vncserver
export LANG=en_US

--报错:内存太小,报错,需要调大内存

--解决:
java -jar –Xmx512M /mysql/osw1/oswbb840/oswbb/oswbba.jar -i /mysql/osw1/oswbb840/oswbb/archive

--报错:An exception occured in insertVmstatLists on line

--解决:
java -Duser.language=en -Duser.country=us -jar /data/oswbb/oswbba.jar -i /data/oswbb/archive/

2.4. 查询分析的结果

2.4.1. Analyze Data

cd /mysql/osw1/oswbb840/oswbb/analysis/

2.4.2. Generate All CPU Gif Files

cd /mysql/osw1/oswbb840/oswbb/gif

OSwatcher CPU:Interrupts Per Second


http://www.kler.cn/a/538175.html

相关文章:

  • WPS如何接入DeepSeek(通过JS宏调用)
  • 打家劫舍3
  • leetcode 80. 删除有序数组中的重复项 II
  • k8s部署elasticsearch
  • 计算机毕业设计Python+Vue.js游戏推荐系统 Steam游戏推荐系统 Django Flask 游 戏可视化 游戏数据分析 游戏大数据 爬虫
  • MongoDB开发规范
  • 为什么要学习AI/机器学习
  • 2025年02月07日Github流行趋势
  • vnev/Scripts/activate : 无法加载文件
  • 深度学习之DCGAN算法深度解析
  • 微服务组件LoadBalancer负载均衡
  • GnuTLS: 在 pull 函数中出错。 无法建立 SSL 连接。
  • 求组合数,
  • ubuntu18.04 编译安装opencv3.4.8
  • 云计算真的可以提高企业的IT敏捷性吗?
  • 【简单】27.移除元素
  • 《Java核心技术 卷II》本地化的数字格式
  • 3.攻防世界 Confusion1(服务器模板注入SSTI)
  • 直接抓取网页的爬虫技术:限制与合规挑战
  • 订单超时设计(1)--- 如何使用redis实现订单超时实时关闭功能
  • 软件测试就业
  • 前端学习-页面加载事件和页面滚动事件(三十二)
  • vue3:点击子组件进行父子通信
  • spring cloud和spring boot的区别
  • 计算机领域QPM、TPM分别是什么并发指标,还有其他类似指标吗?
  • 即时通讯开源项目OpenIM配置可视化-etcd配置中心