OSwatch性能分析工具部署

server/2025/2/9 10:18:51/

        

目录

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.shvi monosw.sh
----------------------monosw.sh-----------------------------
#!/usr/bin/ksh 
if ps -ef | grep OSWatcher | grep -v grep > /dev/null; thenecho "$(date): OSWatcher is running." >> /var/log/oswatcher.log
elseecho "$(date): OSWatcher is not running. Starting..." >> /var/log/oswatcher.logsh "$(dirname "$0")/startOSWbb.sh"
fi

1.5. OSW 生成文件查看

1.6. 关闭 osw

/mysql/osw1/oswbb840/oswbb/stopOSWbb.shORps -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/archiveValidating times in the archive...Starting OSW Analyzer V9.0.9
Copyright (c)  2022 by Oracle CorporationParsing 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 GraphsEnter 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 FilesEnter 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 GraphsEnter 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 DashBoardEnter Q to Quit ProgramPlease 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 GraphsEnter 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 FilesEnter 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 GraphsEnter 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 DashBoardEnter Q to Quit ProgramPlease 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 GraphsEnter 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 FilesEnter 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 GraphsEnter 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 DashBoardEnter Q to Quit ProgramPlease 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.ppmy.cn/server/166197.html

相关文章

ios应用想要下载到手机上只能苹果签名吗

ios APP想要下载到手机上有好几种方式&#xff0c;但是还是需要苹果签名的&#xff0c;苹果签名为ios应用的下载提供了最后一步的帮助&#xff0c;可以说苹果签名就是APP的终点站&#xff0c;是APP的核心。 第一种方式可以采取越狱的方式&#xff0c;但是我们也是知道的&#x…

【CPP】C++后端开发面试:深入理解编程中的锁机制

文章目录 1. 互斥锁&#xff08;Mutex&#xff09;1.1 基本概念1.2 特点1.3 应用场景1.4 示例代码 2. 递归锁&#xff08;Recursive Mutex&#xff09;2.1 基本概念2.2 特点2.3 应用场景2.4 示例代码 3. 读写锁&#xff08;Read-Write Lock&#xff09;3.1 基本概念3.2 特点3.3…

【AI】在Ubuntu中使用docker对DeepSeek的部署与使用

这篇文章前言是我基于部署好的deepseek-r1:8b模型跑出来的 关于部署DeepSeek的前言与介绍 在当今快速发展的技术环境中&#xff0c;有效地利用机器学习工具来解决问题变得越来越重要。今天&#xff0c;我将引入一个名为DeepSeek 的工具&#xff0c;它作为一种强大的搜索引擎&a…

LeetCodeHot 100 第一天

哈希组 1、两数之和使用的是HashMap&#xff0c;如果数字数目比较小可以使用数组作为Hash表&#xff0c;HashMap使用的函数市put&#xff0c;get&#xff0c;containsKey。 2、遇到判断字母异位词首先进行排序&#xff0c;本质上就是找字母异位词的共同之处&#xff0c;也就是…

STM32启动过程概述

1. STM32启动过程概述 STM32 微控制器的启动过程是指从上电或复位开始&#xff0c;到系统开始执行用户程序的整个过程。这个过程包括了硬件初始化、引导加载程序 (Bootloader) 执行、系统时钟配置、外设初始化等步骤。 2. STM32 启动的基本流程 上电或复位 STM32 芯片的启动过…

DeepSeek和ChatGPT对比分析

DeepSeek与ChatGPT作为当前主流的两大AI语言模型&#xff0c;在技术架构、应用场景、成本效益等方面存在显著差异。以下从多个维度进行对比分析&#xff1a; 1. 技术架构与训练方式 DeepSeek 架构&#xff1a;采用混合专家模型&#xff08;MoE&#xff09;&#xff0c;包含6710…

无界构建微前端?NO!NO!NO!多系统融合思路!

文章目录 微前端理解1、微前端概念2、微前端特性3、微前端方案a、iframeb、qiankun --> 使用比较复杂 --> 自己写对vite的插件c、micro-app --> 京东开发 --> 对vite支持更拉跨d、EMP 方案--> 必须使用 webpack5 --> 很多人感觉不是微前端 --> 去中心化方…

Linux 常用命令与实战教程

Linux 常用命令与实战教程 引言 Linux 是一个强大的开源操作系统&#xff0c;广泛应用于服务器、嵌入式系统、个人计算机等多个领域。其灵活性、稳定性和安全性使其成为开发人员和运维工程师的首选操作系统之一。对于开发者而言&#xff0c;熟练掌握 Linux 命令行不仅能提高工…