OSWatch是Oracle提供的一个轻量级的操作系统监控工具,之所以说轻量级,一方面是因为无需安装,开箱即用,另一方面,他调用的都是一些系统级的命令,例如top、iostat、netstat,控制好调用频率,消耗就可控。

可以支持主流的操作系统(AIX、LINUX、Solaris、HP-UX、WINDOWS)。

OSWatch的安装文件可以从这篇MOS下载,

OSWatcher (Includes: [Video]) (Doc ID 301137.1)。

下载的最新版,解压后,目录结构如下,

运行OSWatch,只需要执行startOSWbb.sh,根据这个脚本的内容注释,他可以接4个参数,

$1,采集快照的间隔,单位是秒。

$2,数据存储的时间,单位是小时。

$3和$4是可选的参数,压缩命令和归档文件夹名称。

其实这些参数,都可不输入,默认按照30秒采集一次存储2天的数据,

可以看到,以前这个脚本,叫startOSW.sh,从6.0开始,改为startOSWbb.sh,并且支持第四个参数,

脚本内容很简单,判断下当前是否存在正运行的OSWatch,然后就调用OSWatcher.sh,

真正的精髓就是OSWatcher.sh,一共1700多行,各种判断调用,考虑了各种环境,风格和细节上,还是很值得学习。

启动这个脚本,他会验证各种要执行的指令,然后就开始30秒一次的采集,

P.S. 可选择后台执行,nohup sh startOSWbb.sh 30 1&

[root@bisal oswbb]# ./startOSWbb.sh 30 1
[root@bisal oswbb]# Setting the archive log directory to/opt/software/oswbb/archiveTesting for discovery of OS Utilities...
VMSTAT found on your system.
IOSTAT found on your system.
MPSTAT found on your system.
IP found on your system.
TOP found on your system.
PIDSTAT found on your system.
NFSIOSTAT found on your system.
TRACEROUTE found on your system.Discovery of CPU CORE COUNT
CPU CORE COUNT will be used by oswbba to automatically look for cpu problemsCPU CORE COUNT = 1
VCPUS/THREADS = 1Discovery completed.Starting OSWatcher v8.4.0  on Wed Jun 2 09:32:06 CST 2021
With SnapshotInterval = 30
With ArchiveInterval = 1OSWatcher - Written by Carl Davis, Center of Expertise,
Oracle Corporation
For questions on install/usage please go to MOS (Note:301137.1)Data is stored in directory: /opt/software/oswbb/archiveStarting Data Collection...oswbb heartbeat:Wed Jun 2 21:32:11 CST 2021
oswbb heartbeat:Wed Jun 2 21:32:41 CST 2021

如果停止脚本,可以杀进程,或者执行stopOSW.sh

[root@bisal oswbb]# ./stopOSW.sh

采集完成,数据会存在archive,

oswatch支持数据分析,看起来更直观,执行这个oswbba.jar,就进入了交互模式,最新版本要求java版本在8以上,

[root@bisal oswbb]# java -jar oswbba.jar -i /opt/software/oswbb/archive/Starting OSW Analyzer V8.4.0
OSWatcher Analyzer Written by Oracle Center of Expertise
Copyright (c)  2019 by Oracle CorporationParsing Data. Please Wait...Scanning file headers for version and platform info...Parsing file bisal_pidstat_21.06.02.0900.dat ...Parsing file bisal_iostat_21.06.02.0900.dat ...
This directory already exists. Rewriting...Parsing file bisal_vmstat_21.06.02.0900.dat ...Parsing file bisal_netstat_21.06.02.0900.dat ...Parsing file bisal_top_21.06.02.0900.dat ...Parsing file bisal_ps_21.06.02.0900.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:

提供了很多选项,不同选项,会对应了不同的数据结果集,例如选择1,会展示CPU进程队列的图示信息,

Please Select an Option:1

应该就是java AWT,

另外一个实用的功能,就是能生成dashboard,相当于汇总数据,输入D,可指定他存储的文件夹名称,

Please Select an Option:D
Enter a unique analysis/dashboard directory name or enter <CR> to accept default name:test           A new analysis file analysis/test/analysis.txt has been created.
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Run_Queue.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Run_Adjusted_Queue.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Block_Queue.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_HB.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_PS_Processes.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_Idle.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_Util.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_System.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_User.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_Wa.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_Interrupts.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Context_Switches.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Memory_Swap.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Memory_Free.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Memory_Page_In_Rate.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Memory_Page_Out_Rate.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Cpu_Wa.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_Block_Queue.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_IO_ST.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_IO_AW.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_IO_PB.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_IO_RPS.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_IO_WPS.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_OS_IO_TPS.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_rx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_rx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_rx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_rx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_tx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_tx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_tx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0_tx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_rx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_rx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_rx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_rx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_tx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_tx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_tx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ virbr0-nic_tx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_rx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_rx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_rx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_rx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_tx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_tx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_tx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ lo_tx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_rx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_rx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_rx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_rx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_tx_ok.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_tx_err.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_tx_drp.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_link_ ens33_tx_ovr.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_IpOutRequests.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_IpInReceives.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_IpFragCreates.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_IpFragOKs.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_IpInDiscards.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_IpReasmFails.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_ip_fragments_in_rate.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_ip_fragments_out_rate.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_UdpInDatagrams.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_UdpOutDatagrams.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_UdpInErrors.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_UdpInCsumErrors.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_UdpRcvbufErrors.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_UdpSndbufErrors.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_TcpInSegs.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_TcpOutSegs.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_TcpRetransSegs.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_TcpOutRsts.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_TcpEstabResets.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_TcpAttemptFails.jpg
Generating file analysis/test/dashboard/generated_files/OSWg_tcp_retran_error_rate.jpg
Files written to the analysis directory.

从输出可以看到,生成一系列HTML文件,文件夹中会生成两个文件,

[root@bisal oswbb]# cd analysis/test/
[root@bisal test]# ls
analysis.txt  dashboard

一个是文本文件,汇总了相关数据,如下是章节,

############################################################################
# Contents of This Report:
#
# Section 1: System Status
# Section 2: System Slowdowns
#   Section 2.1: System Slowdown RCA Process Level Ordered By Impact
# Section 3: System General Findings
# Section 4: CPU Detailed Findings
#   Section 4.1: CPU Run Queue:
#   Section 4.2: CPU Utilization: Percent Busy
#   Section 4.3: CPU Utilization: Percent Sys
# Section 5: Memory Detailed Findings
#   Section 5.1: Memory: Process Swap Queue
#   Section 5.2: Memory: Scan Rate
#   Section 5.3  Memory: Page In:
#   Section 5.4  Memory: Page Out:
#   Section 5.5  Memory: Page Tables (Linux only):
#   Section 5.6: Top 5 Memory Consuming Processes Beginning
#   Section 5.7: Top 5 Memory Consuming Processes Ending
# Section 6: Disk Detailed Findings
#   Section 6.1: Disk Percent Utilization Findings
#   Section 6.2: Disk Service Times Findings
#   Section 6.3: Disk Wait Queue Times Findings
#   Section 6.4: Disk Throughput Findings
#   Section 6.5: Disk Reads per Second
#   Section 6.6: Disk Writes per Second
#   Section 6.7: Disk Percent CPU waiting on I/O
# Section 7: Network Detailed Findings
#   Section 7.1  Network Data Link Findings
#   Section 7.2: Network IP Findings
#   Section 7.3: Network UDP Findings
#   Section 7.4: Network TCP Findings
#   Section 7.5: Network Private Interconnect Findings
# Section 8: Process Detailed Findings
#   Section 8.1: PS Process Summary Ordered By Time
#   Section 8.2: PS for Processes with Status = D or T Ordered By Time
#   Section 8.3: PS for (Processes with CPU > 0) When System Idle CPU < 30% Ordered By Time
#   Section 8.4: Top VSZ Processes Increasing Memory per Snapshot
#   Section 8.5: Top RSS Processes Increasing Memory per Snapshot
#   Section 8.6: New Processes Created Since Last Snapshot
#   Section 8.7: Exiting Processes since Last Snapshot
#

另外一个就是HTML的文件,可以打开index.html,

[root@bisal oswbb]# cd dashboard
[root@bisal dashboard]# ls
css  fonts  generated_files  images  index.html  js

图形化展示了采集到的数据,可以点击不同的维度,查看不同的数据,方便且直观,还是比较有用的,

参考文献,

OSWatcher (Includes: [Video]) (Doc ID 301137.1)

OSWatcher Analyzer User Guide (Doc ID 461053.1)

近期更新的文章:

《国足易地比赛的原因》

《数据库hang等待链分析利器》

《会议交流的一些杂谈》

《imp执行错误IMP-00010》

《NULL判断对SQL的影响》

《曾经运维生涯中的几个“最”》

文章分类和索引:

《公众号700篇文章分类和索引》

尝试一下OSWatch相关推荐

  1. 误操作怎么办?试试这个神器-Log Miner

    LogMiner可以用来分析在线/redo日志,也可以用来分析离线日志文件/归档日志,是由一组PL/SQL包和一些动态视图组成,而且是免费的. 参考了老杨的<Logminer:oracle人为误 ...

  2. 公众号1200篇文章分类和索引

    承蒙读者朋友们的关照,截止到今天,杂货铺的文章已经积累到了1200篇,其中有超过2/3的文章都是原创的,即使是转载,我给的底线是一定要加些自己的见解,因为至少得让读者了解到这篇文章的价值,而不仅仅是文 ...

  3. 欧洲杯这次“真”的来了

    上次写欧洲杯的文章还是在疫情前<"真正的"欧洲杯,鸡冻不鸡冻?>,谁都没想到,一场足球盛宴,推迟到了现在,可谓前无来者. 当时还意淫过,再来个足球之旅, 如果让我选择, ...

  4. 正试图在 os 加载程序锁内执行托管代码。不要尝试在 DllMain 或映像初始化函数内运行托管代码......

    当我在窗体初始化的时候,调用了一个外部的dill时,它就不知什么原因的 抛出一个"正试图在 os 加载程序锁内执行托管代码.不要尝试在 DllMain 或映像初始化函数内运行托管代码&quo ...

  5. python读取csv文件第一行_尝试读取CSV文件的第一行返回['/']

    我通过Django上传了一个CSV文件,我试着读它的第一行.文件存储在服务器上的/tmp/csv_file/test.csv 文件如下所示: ^{pr2}$ 我正在尝试获取文件的标题,例如:absol ...

  6. C#尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

    用VS2012调试时发现在调用数据集时提示"尝试读取或写入受保护的内存.这通常指示其他内存已损坏." 用管理员身份运行CMD,输入netsh winsock reset并回车 转载 ...

  7. android 虚方法,尝试在空对象引用上调用虚方法’android.view.View android.view.View.getRootView()’...

    我收到这个错误, "Attempt to invoke virtual method 'android.view.View android.view.View.getRootView()' ...

  8. 您尝试打开的文件_您是否尝试过重新打开软件团队的身份?

    您尝试打开的文件 by Victoriya Kalmanovich 由Victoriya Kalmanovich 您是否尝试过重新打开软件团队的身份? (Have you tried turning ...

  9. oye pandora_我尝试了Pandora出色的功能优先级排序方法。 这是我学到的。

    oye pandora by Josh Temple 通过乔什·坦普尔 我尝试了Pandora出色的功能优先级排序方法. 这是我学到的. (I tried Pandora's brilliant me ...

最新文章

  1. 坑爹的BufferManager
  2. Android fill_parent、wrap_content和match_parent的区别
  3. 分布式服务框架 Zookeeper -- 管理分布式环境中的数据--转载
  4. 注意力机制可视化_Attention isn’t all you need!BERT的力量之源远不止注意力
  5. Hibernate,Session清理缓存时间点
  6. html css表格样式模板_Excel报价单模板,完整表格设计,82套多样式选择,拿来就用...
  7. 云服务器微信faq,开发者FAQ
  8. 最强分布式锁工具:Redisson
  9. 2020大数据技术体系结构图,你值得拥有
  10. c语言错误 应输入声明,C++错误:应输入声明
  11. 程序人生:程序员如何和老板谈升职加薪
  12. 【转】App应用内搜索:移动搜索的新入口
  13. 期货市场倒挂什么意思(期货市场倒挂什么意思啊)
  14. 华为鸿蒙理性,华为的理性 鸿蒙的节奏
  15. Centos7 安装MongoDB
  16. hp小型机日常设备维护检查
  17. 12306官方火车票各种Api接口
  18. Bresenham画线算法的推导
  19. BugTags使用教程
  20. 一人之下ios扫码_一人之下手游ios版下载

热门文章

  1. F12控制视频倍速播放
  2. CMakeList--->CMakeList的编写,cmake,平台通用项目构建工具
  3. 针对“使用U盘提示使用前需要将其格式化,无法访问U盘情况”的解决办法
  4. NAT技术基础与配置(华为设备)
  5. Mysql 分学科拿取前三名的数据
  6. 去摆摊吧,落魄的Java程序员(转载)
  7. FMVSS 302 汽车内饰材料水平燃烧测试
  8. cytoscape.js导出图片png或jpg
  9. 小红书APP群控实战
  10. 辐射发射测试软件,如何进行电子设备的辐射发射测试