OSWbb OS Watcher Black Box安裝配置

DB_BLOCK發表於2014-04-02

OSWbb

OS Watcher Black Box

v140401

 

 

作者

陳攀峰 panfengchen@gmail.com

稽核

 

分類

ORACLE

子類

Utilities

更新時間

2014/04/01

參考文件

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 OSWatcher Black Box (OSWBB) Every System Boot (文件 ID 580513.1)

簡介:

OS Watcher 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可以在單例項上,也可以在RACReal Application 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

 

欄位描述:

注意:可通過作業系統命令:man iostat 檢視到更為詳細的描述。

3.2.    Oswmpstat

mpstat 命令收集和顯示系統中所有邏輯 CPU 的效能統計資訊。

欄位描述:

注意:可通過作業系統命令:man mpstat 檢視到更為詳細的描述。

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

traceroute -I -r -F

traceroute -r -F

traceroute -I -r -F

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

#HP Example

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

echo "zzz ***"`date`

traceroute -r -F

traceroute -r -F

 

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

#Linux Example

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

echo "zzz ***"`date`

traceroute -r -F

traceroute -r -F

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

#Tru64 Example

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

echo "zzz ***"`date`

traceroute -r -f

traceroute -r -f

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

#AIX Example

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

echo "zzz ***"`date`

traceroute -r

traceroute -r

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

# 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 program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks  currently being managed by the Linux kernel. The types of system summary information shown and the types, order and size of information dis-played for tasks are all user configurable and that configuration can be made persistent across 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

 


歡迎大家批評指正

QQ交流群:300392987
論    壇:www.oraclefreebase.com

文件下載地址:http://www.oraclefreebase.com/share/OS-Watcher-Black-Box.pdf

因為文件有圖片,但是這個網站不能釋出帶有圖片的Word,所以,感覺不錯的人可以在上面地址檢視或者加QQ群大家交流。






來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29210156/viewspace-1134300/,如需轉載,請註明出處,否則將追究法律責任。

相關文章