OSWBB 及其开机自启动的配置

本文转载自:http://blog.itpub.net/29210156/viewspace-1134300/


参考文档

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=318266416456288&id=1614397.1&_afrWindowMode=0&_adf.ctrl-state=fc2dw8smz_4

OS Watcher Black Box 用户指南 (文档 ID 1614397.1)

 

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=318267999174331&id=301137.1&_afrWindowMode=0&_adf.ctrl-state=fc2dw8smz_25

OSWatcher (Includes: [Video]) (文档 ID 301137.1)

https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrl-state=hb8zepddj_200&_afrLoop=485384229890345

How To Start OSWatcherBlack Box (OSWBB) Every System Boot (文档 ID 580513.1)

简介:

OSWatcher Black Box (OSWbb) 是一种 UNIX shell 脚本的集合,主要用于收集和归档操作系统和网络的度量,以便为诊断性能问题提供支持。OSWbb 作为服务器上的一组后台进程来运行,定期收集 OS 数据,其调用 Unix 实用程序,如 vmstatnetstat iostat 等。

支持平台:

?  Tru64

?  AIX

?  Solaris

?  HP-UX

?  Linux

1. 下载地址:

1.1.       OSWbbID301137.1

https://support.oracle.com/epmos/main/downloadattachmentprocessor?attachid=301137.1:OSW_FILE&clickstream=no

 

1.2.       osw-service rpm包:ID580513.1

 

https://support.oracle.com/epmos/main/downloadattachmentprocessor?attachid=580513.1%3ARUNTIME&docType=HOWTO&action=download

 

 

2. 收集诊断数据:

2.1.       安装OSWbb

OSW可以在单实例上,也可以在RACRealApplication Cluster)环境中运行,但是在RAC中,需要在两个节点上都安装。

安装过程:

建立一个目录osw,并且用FTP工具将下载到的软件传到新建的目录里面,并解压。

[root@Ray ~]# mkdir osw

[root@Ray osw]# tar xvf oswbb713.tar

解压完成之后会发现,这个工具自动呢新建了一个目录

[root@Ray osw]# ls

oswbb  oswbb713.tar

 

只要我们多加留意就会发现,这个工具会将产生的报告自动归档,并且OSWbb这个目录下面有我们需要的很多脚本。

[root@Ray oswbb]# ls -l

total 396

drwxrwxrwx  2 oracle oinstall   4096 Nov  1  2013 analysis

drwxr-xr-x 11 root   root       4096 Mar 13 17:08 archive

-rwxrwxrwx  1 oracle oinstall     67 Jan 16  2014 call_du.sh

-rwxrwxrwx  1 oracle oinstall     68 Oct  8  2013 call_sar.sh

-rwxrwxrwx  1 oracle oinstall     71 Jan  7  2014 call_uptime.sh

drwxrwxrwx  2 oracle oinstall   4096 Nov  1  2013 data

drwxrwxrwx  4 oracle oinstall   4096 Nov  1  2013 docs

-rwxrwxrwx  1 oracle oinstall    626 Jan 16  2014 Example_extras.txt

-rwxrwxrwx  1 oracle oinstall   1864 Oct  8  2013 Exampleprivate.net

drwxrwxrwx  2 oracle oinstall   4096 Nov  1  2013 gif

-rwxrwxrwx  1 oracle oinstall    743 Oct  8  2013 iosub.sh

drwxr-xr-x  2 root   root       4096 Mar 13 19:50 locks

-rwxrwxrwx  1 oracle oinstall   1486 Jan  9  2014 ltop.sh

-rwxrwxrwx  1 oracle oinstall    542 Oct  8  2013 mpsub.sh

-rwxrwxrwx  1 oracle oinstall    740 Oct  8  2013 nfssub.sh

-rwxrwxrwx  1 oracle oinstall   4424 Oct 17  2013 OSWatcherFM.sh

-rwxrwxrwx  1 oracle oinstall  32462 Jan 18  2014 OSWatcher.sh

-rw-r--r--  1 oracle oinstall 230316 Feb 28  2014 oswbba.jar

-rwxrwxrwx  1 oracle oinstall    414 Oct  8  2013 oswib.sh

-rwxrwxrwx  1 oracle oinstall    435 Jan  9  2014 oswnet.sh

-rwxrwxrwx  1 oracle oinstall    825 Oct  8  2013 oswrds.sh

-rwxrwxrwx  1 oracle oinstall    524 Oct  8  2013 oswsub.sh

drwxrwxrwx  2 oracle oinstall   4096 Nov  1  2013 profile

-rwxrwxrwx  1 oracle oinstall   1445 Oct 18  2013 psmemsub.sh

drwxrwxrwx  2 oracle oinstall   4096 Nov  1  2013 src

-rwxrwxrwx  1 oracle oinstall   2385 Oct  8  2013 startOSWbb.sh

-rwxrwxrwx  1 oracle oinstall    542 Oct  8  2013 stopOSWbb.sh

-rwxrwxrwx  1 oracle oinstall    746 Nov  6  2013 tarupfiles.sh

-rwxrwxrwx  1 oracle oinstall   4219 Nov  6  2013 tar_up_partial_archive.sh

drwxr-xr-x  2 root   root       4096 Mar 13 19:50 tmp

-rwxrwxrwx  1 oracle oinstall    537 Jan  9  2014 topaix.sh

-rwxrwxrwx  1 oracle oinstall    544 Oct  8  2013 vmsub.sh

-rwxrwxrwx  1 oracle oinstall   1486 Jan  9  2014 xtop.sh

 

2.2.       卸载OSWbb

卸载OSWbb直接可以用操作系统命令将解压的OSWbb删除即可。

rm –rf oswbb

2.3.       启动OSWbb

安装 OSWbb 的目录下执行 startOSWbb.sh shell 脚本就可以直接启动OSWbb

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

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

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

ARG4 = (可选)保存归档的非默认路径

[root@Ray oswbb]# ./startOSWbb.sh

[root@Ray oswbb]#

Info...You did not enter a value for snapshotInterval.

Info...Using default value = 30

Info...You did not enter a value for archiveInterval.

Info...Using default value = 48

Setting the archive log directory to/root/osw/oswbb/archive

Testing for discovery of OS Utilities...

VMSTAT found on your system.

IOSTAT found on your system.

MPSTAT found on your system.

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 = 1

Discovery completed.

Starting OSWatcher Black Box v7.1  on Fri Mar 13 17:08:39 CST 2015

With SnapshotInterval = 30

With ArchiveInterval = 48

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: /root/osw/oswbb/archive

Starting Data Collection...

oswbb heartbeat:Fri Mar 13 17:08:44 CST 2015

oswbb heartbeat:Fri Mar 13 17:09:14 CST 2015

oswbb heartbeat:Fri Mar 13 17:09:44 CST 2015

从上面可以看出,该脚本包含 2 个参数,分别用以控制数据的收集频率和要归档数据的小时数。

例如:

?  这将启动工具并以 30 秒间隔来收集数据,并将前 48 个小时的数据记录到归档文件。

[root@Ray oswbb]# ./startOSWbb.sh

?  这将启动工具并以 60 秒间隔来收集数据,并将前 10 个小时的数据记录到归档文件,并且自动压缩文件。

[root@Ray oswbb]# ./startOSWbb.sh 60 10 gzip

[root@Ray oswbb]# ./startOSWbb.sh 60 10 gzip

An OSWatcher process has been detected.

Please stop it before starting a new OSWatcher process.

[root@Ray oswbb]# ./stopOSWbb.sh

[root@Ray oswbb]# ./startOSWbb.sh 60 10 gzip

[root@Ray oswbb]# Info...Zip option IS specified.

Info...OSW will use gzip to compress files.

Setting the archive log directory to/root/osw/oswbb/archive

Testing for discovery of OS Utilities...

VMSTAT found on your system.

IOSTAT found on your system.

MPSTAT found on your system.

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 = 1

Discovery completed.

Starting OSWatcher Black Box v7.1  on Fri Mar 13 19:49:59 CST 2015

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: /root/osw/oswbb/archive

Starting Data Collection...

oswbb heartbeat:Fri Mar 13 19:50:04 CST 2015

oswbb heartbeat:Fri Mar 13 19:51:04 CST 2015

oswbb heartbeat:Fri Mar 13 19:52:04 CST 2015

oswbb heartbeat:Fri Mar 13 19:53:04 CST 2015


?  这将启动工具并以 60 秒间隔来收集数据,并将前 10 个小时的数据记录到归档文件,自动压缩文件,并且保存到一个非默认路径下

[root@Ray oswbb]# ./startOSWbb.sh 60 10 gzip /u02/tools/oswbb/archive

?  这将启动工具并以 60 秒间隔来收集数据,并将前 48 个小时的数据记录到归档文件,不自动压缩文件,并且保存到一个非默认路径下。

[root@Ray oswbb]# ./startOSWbb.sh 60 48 NONE /u02/tools/oswbb/archive

?  这将启动该工具,将进程置于后台运行,允许工具在会话被终止后继续运行,以 60 秒间隔收集数据,并将前 10 个小时的数据记录到归档文件。

nohup ./startOSWbb.sh 60 10 &

2.4.       停止OSWbb

在安装目录下面有个stopOSWbb.sh这将终止与该工具关联的所有进程。

[root@Ray oswbb]# ./stopOSWbb.sh

3. 诊断数据输出

通过上面的测试,我们不难发现,OSWbb产生的数据,都会按照不同的格式归档到一个名为archive的目录下面。归档目录包含 7 个子目录,每个数据收集器对应一个。这些目录命名为 oswiostatoswmpstatoswnetstatoswprvtnetoswpsoswtop oswvmstat

3.1.    Oswiostat

iostat 命令用于监视系统输入/输出设备负载。据此信息可更改系统配置,以便更好地平衡物理磁盘和适配器之间的输入/输出负载。

 

zzz ***Fri Mar 13 17:59:50 CST 2015                   

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

           0.98    0.00    2.94    0.00    0.00   96.08

 

字段描述:

注意:可通过操作系统命令:maniostat 查看到更为详细的描述。

3.2.    Oswmpstat

mpstat 命令收集和显示系统中所有逻辑 CPU 的性能统计信息。

字段描述:

注意:可通过操作系统命令:manmpstat 查看到更为详细的描述。

3.3.    Oswnetstat

netstat 命令显示当前 TCP/IP 网络连接和协议统计信息。

[root@Ray oswnetstat]# more ain Ray_netstat_15.03.13.1700.dat                                                             

ain: No such file or directory                                                                                            

::::::::::::::                                                                                                             

Ray_netstat_15.03.13.1700.dat                                                                                             

::::::::::::::                                                                                                             

Linux OSWbb v7.1                                                                                                          

zzz ***Fri Mar 13 17:08:44 CST 2015                                                                                       

Kernel Interface table                                                                                                    

Iface   MTU Met RX-OK RX-ERR RX-DRP RX-OVR  TX-OK TX-ERR TX-DRP TX-OVR Flg

eth0   1500   0  2958      0      0      0   1382      0      0      0 BMRU

lo    16436   0  2813      0      0      0   2813      0      0      0 LRU                                     

Ip:                                                                                                                       

    5684 total packets received                                                                                           

    0 forwarded                                                                                                           

    0 incoming packets discarded                                                                                          

    5684 incoming packets delivered                                                                                       

    4136 requests sent out                                                                                                

    10 dropped because of missing route                                                                                   

Icmp:                                                                                                                     

    1 ICMP messages received                                                                                               

    0 input ICMP message failed.                                                                                          

    ICMP input histogram:                                                                                                  

        destination unreachable: 1                                                                                        

    1 ICMP messages sent                                                                                                   

    0 ICMP messages failed                                                                                                

    ICMP output histogram:                                                                                                 

        destination unreachable: 1                                                                                        

IcmpMsg:                                                                                                                   

        InType3: 1                                                                                                        

        OutType3: 1                                                                                                        

Tcp:                                                                                                                      

    124 active connections openings                                                                                        

    8 passive connection openings                                                                                         

    120 failed connection attempts                                                                                        

    1 connection resets received                                                                                          

    4 connections established                                                                                             

    5611 segments received                                                                                                

    4107 segments send out                                                                                                

    5 segments retransmited                                                                                               

    0 bad segments received.                                                                                              

    121 resets sent                                                                                                       

Udp:                                                                                                                       

    20 packets received                                                                                                   

    1 packets to unknown port received.                                                                                    

    0 packet receive errors                                                                                               

    21 packets sent                                                                                                        

UdpLite:                                                                                                                  

TcpExt:                                                                                                                    

    2 TCP sockets finished time wait in fast timer                                                                        

    507 delayed acks sent                                                                                                  

    Quick ack mode was activated 5 times                                                                                  

    2 packets directly queued to recvmsg prequeue.                                                                         

    2607 packets header predicted                                                                                         

    545 acknowledgments not containing data received                                                                       

    1651 predicted acknowledgments                                                                                        

    TCPDSACKUndo: 1                                                                                                        

    4 congestion windows recovered after partial ack                                                                      

    0 TCP data loss events                                                                                                 

    5 other TCP timeouts                                                                                                  

    5 DSACKs sent for old packets                                                                                          

    5 DSACKs received                                                                                                     

    1 connections reset due to early user close                                                                           

IpExt:                                                                                                                    

    InMcastPkts: 12                                                                                                       

    OutMcastPkts: 14                                                                                                      

    InBcastPkts: 51                                                                                                       

    InOctets: 6688324                                                                                                     

    OutOctets: 5296564                                                                                                     

    InMcastOctets: 1997                                                                                                   

    OutMcastOctets: 2077                                                                                                   

    InBcastOctets: 4350                                                                                                   

 

字段描述:

OSWbb 生成的 netstat 输出包含两个部分。第一部分包含关于所有网络接口的信息。第二部分包含关于每个协议统计的信息。

第一部分:

第二部分:

每个协议统计信息可以分为下面若干类

?  RAWIP(原始 IP)数据包

?  IPv4 数据包  

?  ICMPv4 数据包

?  IPv6 数据包  

?  ICMPv6 数据包

?  UDP 数据包   

?  IGMP 数据包  

 

3.4.       Oswprvtnet

收集关于 RAC 私有网络状态的信息。这需要用户手动将这些专用网络的条目添加到基本 oswbb 目录中的 private.net 文件

[root@Ray oswbb]# cat Exampleprivate.net

######################################################################

# 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 <node1-priv>

traceroute -I -r -F <node1-priv>

traceroute -r -F <node2-priv>

traceroute -I -r -F <node2-priv>

######################################################################

#HP Example

######################################################################

echo "zzz ***"`date`

traceroute -r -F <node1-priv>

traceroute -r -F <node2-priv>

 

######################################################################

#Linux Example

######################################################################

echo "zzz ***"`date`

traceroute -r -F <node1-priv>

traceroute -r -F <node2-priv>

######################################################################

#Tru64 Example

######################################################################

echo "zzz ***"`date`

traceroute -r -f <node1-priv>

traceroute -r -f <node2-priv>

######################################################################

#AIX Example

######################################################################

echo "zzz ***"`date`

traceroute -r <node1-priv>

traceroute -r <node2-priv>

######################################################################

# DO NOT DELETE THE FOLLOWING LINE!!!!!!!!!!!!!!!!!!!!!

######################################################################

rm locks/lock.file

         由于我的测试环境是单实例,就没有办法得出更为详细的结果。

3.5.       Oswps

ps(进程状态)命令列出系统中当前运行的所有进程,并提供关于 CPU 消耗、进程状态、进程优先级等的信息。ps 命令具有很多选项,用以控制显示哪些进程以及如何格式化输出。

进入到Archive目录,查看oswps可以看到系统中当前运行的所有的归档。这里不再赘述。

我记得前两天EMOS(系统)出问题,老大最先让我查的就是这个。对于RAC的系统崩溃之前的进程状态对于根本原因的分析可能会非常重要。

3.6.       Oswtop

The top programprovides a dynamic real-time view of a running system. It can display systemsummary information as well as a list of tasks currently being managed by the Linux kernel. The types of system summaryinformation shown and the types, order and size of information dis-played fortasks are all user configurable and that configuration can be made persistentacross restarts.

这里调用的就是操作系统的top命令,我想大家对操作系统的top命令都很熟悉了。

3.7.       Oswstat

oswstat不但报告虚拟内存,vmstat 还报告关于进程、磁盘、陷阱/中断率和 CPU 活动的某些内核统计信息。

 

字段描述:

 

4. OSW绘制输出图形

可以使用X server工具,导出图形。

java -jar oswbba.jar -i /oswbb/archive

 

示例图形:

 

5. 配置OSW自启动

OSW不会随着系统的启动而启动,所以,配置系统自启动是一件比较重要的事情。

但是配置自启动时,需要安装RPM包。

5.1.       安装OSW-service

osw-service RPM 包提供了脚本让系统重启时运行OSWaterch,并且在系统shutdowngracefullystop

[root@Ray osw]# rpm -ivh oswbb-service-1.1.7-1.

oswbb-service-1.1.7-1.noarch.rpm  oswbb-service-1.1.7-1.src.rpm    

[root@Ray osw]# rpm -ivh oswbb-service-1.1.7-1.noarch.rpm

Preparing...                ########################################### [100%]

   1:oswbb-service          ########################################### [100%]

5.2.       配置相关参数

[root@Ray sysconfig]# vi /etc/oswbb.conf

# Set OSW_ARCHIVE where the logs should be stored

# OSW_ARCHIVE='archive'

# Set OSW_COMPRESSION to the desired compression scheme

# OSW_COMPRESSION='gzip'

# Set OSW_HOME to the directory where your OSWatcher tools are installed

# OSW_HOME='/opt/oswbb'

# Set OSW_INTERVAL to the number of seconds between collections

# OSW_INTERVAL='30'

# Set OSW_RETENTION to the number of hours logs are to be retained

# OSW_RETENTION='48'

# Set OSW_USER to the owner of the OSW_HOME directory

# OSW_USER='root'

5.3.       执行相关命令,开机启动

# /sbin/service oswbb start

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值