OSW工具-Oracle的OS watcher

OSW简介
 
OSW是Oracle提供的一个监控操作系统的工具包,主要用于监视系统的状态,包括cpu,内存,io,网络等,可以运行于linux和windows,这个工具包可以从Metalink下载。

Metalink Note:301137.1

 

在OSW 4.0 之前是:OSWatcher 和 OSWg的关系。

OSW 4.0 后变成了: OSWbb 与 OSWbba 的关系。

 

安装及启动


下载解包以后即可使用:

下面用osw4.0做为例子,4.0以前的版本是一样的

下载好之后,可以 直接解压使用
[oracle@test10 osw]$ tar -xvf oswbb4.0.tar 
oswbb/
oswbb/htop.sh
oswbb/docs/
oswbb/docs/OSWbba_README.txt
oswbb/docs/OSW_bb_README.txt
oswbb/docs/OSW_Black_Box_Analyzer_Overview.pdf
oswbb/docs/OSWatcher_Black_Box_UG.pdf
oswbb/docs/OSWatcher_Black_Box_Analyzer_UG.pdf
oswbb/Exampleprivate.net
oswbb/stopOSWbb.sh    --关闭osw
oswbb/iosub.sh
oswbb/profile/
oswbb/OSWatcherFM.sh
oswbb/mpsub.sh
oswbb/gif/            --生成的图片放在这里
oswbb/pssub.sh
oswbb/oswnet.sh
oswbb/vmsub.sh
oswbb/oswlnxio.sh
oswbb/oswib.sh
oswbb/startOSWbb.sh    --开始osw 后面有两个参加,第一个是间隔时间(S),第二个是保存时间(HH),不带参数为每30秒采样一样,保存48小时
oswbb/oswsub.sh
oswbb/analysis/
oswbb/oswbba.jar       --生成图片时运行这个jar包
oswbb/locks/
oswbb/tmp/
oswbb/OSWatcher.sh
oswbb/topaix.sh
oswbb/tarupfiles.sh
oswbb/xtop.sh
oswbb/src/
oswbb/src/Thumbs.db
oswbb/src/OSW_profile.htm
oswbb/src/tombody.gif
oswbb/src/missing_graphic.gif
oswbb/src/coe_logo.gif
oswbb/src/watch.gif
oswbb/src/oswbba_input.txt
oswbb/oswrds.sh

开始osw:
[oracle@test10 oswbb]$ ./startOSWbb.sh 
[oracle@test10 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

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 v4.0   on Wed Oct 10 12:19:25 EDT 2012
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 [email protected]

Starting Data Collection...

oswbb heartbeat:Wed Oct 10 12:19:30 EDT 2012
 
产生的数据保存在archive里。
但这里的数据是.dat的文件,不易看,可以使用OSWbba 生成图像。
 
使用OSWbba前先设置jdk,安装 oracle时会默认安装jdk 
PATH=$ORACLE_HOME/jdk/bin:$PATH        --设置jdk

java -jar oswbba.jar -i /oracle/osw/osw/osw/oswbb4.0/oswbb/archive      --生成图片,后面的路径为osw收集的数据保存的路径


[oracle@test10 oswbb]$ java -jar oswbba.jar -i /oracle/osw/osw/osw/oswbb4.0/oswbb/archive

Starting OSW Black Box Analyzer V4.0
OSWatcher Black Box Analyzer Written by Oracle Center of Expertise
Copyright (c)  2012 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file test10.com.cn_iostat_12.10.10.1200.dat ...

Parsing file test10.com.cn_vmstat_12.10.10.1200.dat ...

Parsing file test10.com.cn_top_12.10.10.1200.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 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter 8 to Generate All Disk Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently Displayed Graphs
Enter P to Generate A Profile
Enter A to Analyze Data
Enter Q to Quit Program

Please Select an Option:8
device=dm-0
Generating file gif/Oct10120543_1349886246/OSWg_dm-0_OS_IO_RPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_dm-0_OS_IO_WPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_dm-0_OS_IO_ST.gif
Generating file gif/Oct10120543_1349886246/OSWg_dm-0_OS_IO_PB.gif
device=sda
Generating file gif/Oct10120543_1349886246/OSWg_sda_OS_IO_RPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda_OS_IO_WPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda_OS_IO_ST.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda_OS_IO_PB.gif
device=sda1
Generating file gif/Oct10120543_1349886246/OSWg_sda1_OS_IO_RPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda1_OS_IO_WPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda1_OS_IO_ST.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda1_OS_IO_PB.gif
device=dm-1
Generating file gif/Oct10120543_1349886246/OSWg_dm-1_OS_IO_RPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_dm-1_OS_IO_WPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_dm-1_OS_IO_ST.gif
Generating file gif/Oct10120543_1349886246/OSWg_dm-1_OS_IO_PB.gif
device=sda2
Generating file gif/Oct10120543_1349886246/OSWg_sda2_OS_IO_RPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda2_OS_IO_WPS.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda2_OS_IO_ST.gif
Generating file gif/Oct10120543_1349886246/OSWg_sda2_OS_IO_PB.gif

根据需要生成图片,图片保存在gif文件夹下。

[oracle@test10 oswbb]$ ./stopOSWbb.sh   --停止osw


osw4.0前的版本是一样的,
生成图片时用的是 oswg.jar 这个jar包
java -jar oswg.jar -i /oracle/osw/osw/osw/oswbb4.0/oswbb/archive

 

OSW的诊断信息字段含义说明

 

 

 

字段

描述
oswiostat
tin Shows the total number of characters read by the system for all ttys
tout Shows the total number of characters written by the system to all ttys.
kps indicates the amount of data transferred (read or written) to the drive in KB per second
tps Indicates the number of transfers per second that were issued to the physical disk. A transfer is an I/O request to the physical disk. Multiple logical requests can be combined into a single I/O request to the disk.
serv average response time of transactions, in milliseconds
us Percentage of CPU cycles spent on user processes
sy Percentage of CPU cycles spent on system processes wt
wt Shows the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request
id
 
Percentage of unused CPU cycles or idle time when the CPU is basically doing nothing .
oswmpstat
cpu Processor ID
minf Minor faults
mif Major Faults
xcal Processor cross-calls (when one CPU wakes up another by interrupting it).
intr Interrupts
ithr
 
Interrupts as threads (except clock)
csw Context switches
icsw Involuntary context switches
migr Thread migrations to another processor
smtx Number of times a CPU failed to obtain a mutex
srw Number of times a CPU failed to obtain a read/write lock on the first try
syscl Number of system calls
usr Percentage of CPU cycles spent on user processes
sys Percentage of CPU cycles spent on system processes
wt Percentage of CPU cycles spent waiting on event
idl Percentage of unused CPU cycles or idle time when the CPU is basically doing nothing
oswnetstat
name Device name of interface
Mtu Maximum transmission unit
Net Network Segment Address
address Network address of the device
ipkts Input packets
Ierrs Input errors
opkts Output Packets
Oerrs Output errors
collis Collisions
queue Number in the Queue
oswps
f Flags s State of the process
uid The effective user ID number of the process
pid The process ID of the process
ppid The process ID of the parent process.
d Processor utilization for scheduling (obsolete).
pri The priority of the process.
ni Nice value, used in priority computation.
addr The memory address of the process.
sz The total size of the process in virtual memory, including all mapped files and devices, in pages.
wchan The address of an event for which the process is sleeping (if blank, the process is running).
stime The starting time of the process, given in hours, minutes, and seconds.
tty The controlling terminal for the process (the message ?, is printed when there is no controlling terminal).
time The cumulative execution time for the process.
cmd The command name process is executing.
oswtop
PID Process ID of process
USERNAME Username of process
THR Process thread PRI Priority of process
NICE Nice value of process
SIZE Total size of a process, including code and data, plus the stack space in kilobytes
RES Amount of physical memory used by the process
STATE Current CPU state of process. The states can be S for sleeping, D for uninterrupted, R for running, T for stopped/traced, and Z for zombied
TIME The CPU time that a process has used since it started
%CPU The CPU time that a process has used since the last update
COMMAND The task's command name
oswvmstat
PROCS
r Number of processes that are in a wait state and basically not doing anything but waiting to run
b Number of processes that were in sleep mode and were interrupted since the last update
w Number of processes that have been swapped out by mm and vm subsystems and have yet to run
MEMORY
swap The amount of swap space currently available free The size of the free list
PAGE
re page reclaims
mf minor faults
pi kilobytes paged in
po kilobytes paged out
fr kilobytes freed
de anticipated short-term memory shortfall (Kbytes)
sr pages scanned by clock algorithm
DISK
Bi Disk blocks sent to disk devices in blocks per second
FAULTS
In Interrupts per second, including the CPU clocks
Sy System calls
Cs Context switches per second within the kernel
CPU
Us Percentage of CPU cycles spent on user processes
Sy Percentage of CPU cycles spent on system processes
Id Percentage of unused CPU cycles or idle time when the CPU is basically doing nothing

 

OSW的设置

 

当OSW安装完毕后,OSW的解压缩脚本里就提供了管理osw的启动和停止的scripts。当第一次运行OSW的时候,系统会自动在osw的目录下创建一个子目录archive,并在archive目录下再创建7个子目录。

[cs1] /oracle/osw> cd archive
[cs1] /oracle/osw/archive> ls -ltr
total 0
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswprvtnet
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswvmstat
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswtop
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswps
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswnetstat
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswmpstat
drwxr-xr-x 2 oracle dba 256 Jul 13 10:24 oswiostat
[cs1] /oracle/osw/archive>

 

如果要收集private networks 信息,必须要手工创建一个可执行文件在osw目录下,并且命名为private.net。这个文件的设置可以参考osw目录下提供的Exampleprivate.net.这个文件中包含了用来检查RAC private networks 运行traceroute的命令.

比如:

traceroute -r -F node1
traceroute -r -F node2

 

报错及处理:

报错一:

[oracle@test oswbb]$ java -jar oswbba.jar -i archive

Starting OSW Black Box Analyzer V4.0.1
OSWatcher Black Box Analyzer Written by Oracle Center of Expertise
Copyright (c)  2012 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file TEST_iostat_13.10.19.1700.dat ...
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:10:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:11:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:12:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:13:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:14:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:15:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:16:49 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:25:59 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:26:29 2012
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: May 16 17:26:59 2012

Parsing file TEST_vmstat_13.10.19.1700.dat ...
An exception occured in insertVmstatLists on line 8
An exception occured in insertVmstatLists on line 14
An exception occured in insertVmstatLists on line 20
An exception occured in insertVmstatLists on line 26
An exception occured in insertVmstatLists on line 32
An exception occured in insertVmstatLists on line 38
An exception occured in insertVmstatLists on line 44
An exception occured in insertVmstatLists on line 53
An exception occured in insertVmstatLists on line 59
An exception occured in insertVmstatLists on line 65

Parsing file TEST_top_13.10.19.1700.dat ...


No data found in input archive directory archive
Please rerun OSWbba with proper input directory containing OSW archive data.
Program aborting...

 

在生成图形界面的时候报错,注意Timestamp Error报错信息, 产生这个错误的原因就是我的操作系统是中文环境,osw要英文日期格式才可以。

 

解决办法:

[oracle@TEST archive]$ echo $LANG 
zh_CN.UTF-8

[oracle@TEST ~]$ LANG=en
[oracle@TEST ~]$ echo $LANG
en

 

报错二:

 

[oracle@TEST oswbb]$ java -jar oswbba.jar -i archive

Starting OSW Black Box Analyzer V4.0.1
OSWatcher Black Box Analyzer Written by Oracle Center of Expertise
Copyright (c)  2012 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file TEST_iostat_13.10.19.1700.dat ...
Parsing file TEST_iostat_13.10.19.1800.dat ...

Parsing file TEST_vmstat_13.10.19.1700.dat ...
Parsing file TEST_vmstat_13.10.19.1800.dat ...

Parsing file TEST_top_13.10.19.1700.dat ...
Parsing file TEST_top_13.10.19.1800.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 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter 8 to Generate All Disk Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently Displayed Graphs
Enter P to Generate A Profile
Enter A to Analyze Data
Enter Q to Quit Program

Please Select an Option:2
>>> Input Error:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
        at java.awt.Window.(Window.java:318)
        at java.awt.Frame.(Frame.java:419)
        at java.awt.Frame.(Frame.java:384)
        at e.a(Unknown Source)
        at OSWGraph.OSWGraph.main(Unknown Source)
[oracle@TEST oswbb]$

 

原因:无法通过X11图形界面显示,因为我用的SecureCRT,没有图形界面,故报错。

 

解决办法:

如果能访问服务器的图形界面最好,如何条件不允许,可以使用工具Xmanager或者VNC


 VNC的安装配置详见:http://blog.csdn.net/langkeziju/article/details/9832879

 

你可能感兴趣的:(linux)