oracle系统监控工具oswatch简介!

oswatch(简称osw)是oracle的一个操作系统监控工具,oswatch是一个轻量级的操作系统监控工具,通过调用系统的命令完成信息的收集,并形成历史数据,命令如下:ps ,top ,mpstat ,iostat,netstat ,traceroute vmstat 。支持的操作系统有AIX ,Tru64 ,Solaris ,HP-UX ,Linux 。 可以在metlink直接下载:OS Watcher User Guide [ID 301137.1]   (Metalink Note:301137.1)  下载的就是tar包,然后直接解压就可以使用的。osw是一个java应用,可以在服务器上运行。


注意:osw工具需要以root用户来操作哦!

1、安装部署(解压既可)

[root@linux app]# pwd
/u01/app
[root@linux app]# ll osw302.tar 
-rw-r--r-- 1 oracle oinstall 1366016 12-13 02:02 osw302.tar
[root@linux app]# tar xvf osw302.tar 
osw/
osw/Exampleprivate.net
osw/OSWatcher.sh
osw/OSWatcherFM.sh
osw/OSWgREADME.txt
osw/iosub.sh
osw/mpsub.sh
osw/oswg.jar
osw/oswib.sh
osw/oswlnxio.sh
osw/oswlnxtop.sh
osw/oswnet.sh
osw/oswrds.sh
osw/oswsub.sh
osw/pssub.sh
osw/startOSW.sh
osw/stopOSW.sh
osw/tarupfiles.sh
osw/topaix.sh
osw/topsub.sh
osw/vmsub.sh
osw/tmp/
osw/src/
osw/src/coe_logo.gif
osw/src/missing_graphic.gif
osw/src/oswg_input.txt
osw/src/OSW_profile.htm
osw/src/Thumbs.db
osw/src/tombody.gif
osw/src/watch.gif
osw/README.txt
[root@linux app]# ll osw/
总计 1336
-rwxr-xr-x 1 1003 dba    1730 2009-08-20 Exampleprivate.net
-rwxr-xr-x 1 1003 dba     549 2009-08-20 iosub.sh
-rwxr-xr-x 1 1003 dba     549 2009-08-20 mpsub.sh
-rwxr-xr-x 1 1003 dba    4451 2009-08-20 OSWatcherFM.sh
-rwxr-xr-x 1 1003 dba   22511 2011-05-04 OSWatcher.sh
-rw-r--r-- 1 1003 dba 1226302 2011-02-11 oswg.jar
-rw-r--r-- 1 1003 dba   14781 2011-05-04 OSWgREADME.txt
-rwxr-xr-x 1 1003 dba     415 2009-08-20 oswib.sh
-rwxr-xr-x 1 1003 dba     659 2009-08-20 oswlnxio.sh
-rwxr-xr-x 1 1003 dba     829 2009-08-20 oswlnxtop.sh
-rwxr-xr-x 1 1003 dba     357 2009-08-20 oswnet.sh
-rwxr-xr-x 1 1003 dba     826 2009-08-20 oswrds.sh
-rwxr-xr-x 1 1003 dba     529 2009-08-20 oswsub.sh
-rwxr-xr-x 1 1003 dba     549 2009-08-20 pssub.sh
-rw-r--r-- 1 1003 dba    8513 2011-05-04 README.txt
drwxr-xr-x 2 1003 dba    4096 2009-08-31 src
-rwxr-xr-x 1 1003 dba    1638 2011-02-11 startOSW.sh
-rwxr-xr-x 1 1003 dba     560 2009-08-20 stopOSW.sh
-rwxr-xr-x 1 1003 dba     127 2009-08-20 tarupfiles.sh
drwxr-xr-x 2 1003 dba    4096 2009-08-20 tmp
-rwxr-xr-x 1 1003 dba     431 2009-08-20 topaix.sh
-rwxr-xr-x 1 1003 dba     550 2009-08-20 topsub.sh
-rwxr-xr-x 1 1003 dba     549 2009-08-20 vmsub.sh

从上面看,权限有点怪,不过不管它,继续!


2、启动监控器

启动监控就是调用startOSW.sh脚本。
# ./startOSW.sh arg1 arg2

arg1:数据收集的间隔,以秒为单位。
arg2: 数据收集多长时间,以小时为单位。

例如:

[root@linux osw]# cd /u01/app/osw/
[root@linux osw]# pwd
/u01/app/osw
[root@linux osw]# ./startOSW.sh 30 1
[root@linux osw]# 

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.

Discovery completed.

Starting OSWatcher v3.0.2   on 2011年 12月 13日 星期二 02:27:42 CST
With SnapshotInterval = 30
With ArchiveInterval = 1

OSWatcher - Written by Carl Davis, Center of Expertise, Oracle Corporation

Starting Data Collection...

osw heartbeat:2011年 12月 13日 星期二 02:27:42 CST
osw heartbeat:2011年 12月 13日 星期二 02:28:13 CST
osw heartbeat:2011年 12月 13日 星期二 02:28:44 CST
... ...
以上这里就是没30秒采样一次,连续采用一个小时。


初次使用会在OSW_HOME目录下面生成一个archive目录,此目录就是存放采样信息的:

[root@linux osw]# cd /u01/app/osw/
[root@linux osw]# pwd
/u01/app/osw
[root@linux osw]#  ll archive/
总计 36
drwxr-xr-x 2 root root 4096 12-13 02:16 oswiostat
drwxr-xr-x 2 root root 4096 12-13 02:16 oswmeminfo
drwxr-xr-x 2 root root 4096 12-13 02:16 oswmpstat
drwxr-xr-x 2 root root 4096 12-13 02:16 oswnetstat
drwxr-xr-x 2 root root 4096 12-13 02:16 oswprvtnet
drwxr-xr-x 2 root root 4096 12-13 02:16 oswps
drwxr-xr-x 2 root root 4096 12-13 02:16 oswslabinfo
drwxr-xr-x 2 root root 4096 12-13 02:16 oswtop
drwxr-xr-x 2 root root 4096 12-13 02:16 oswvmstat
[root@linux osw]# cd archive/
[root@linux archive]# ll
总计 36
drwxr-xr-x 2 root root 4096 12-13 02:16 oswiostat
drwxr-xr-x 2 root root 4096 12-13 02:16 oswmeminfo
drwxr-xr-x 2 root root 4096 12-13 02:16 oswmpstat
drwxr-xr-x 2 root root 4096 12-13 02:16 oswnetstat
drwxr-xr-x 2 root root 4096 12-13 02:16 oswprvtnet
drwxr-xr-x 2 root root 4096 12-13 02:16 oswps
drwxr-xr-x 2 root root 4096 12-13 02:16 oswslabinfo
drwxr-xr-x 2 root root 4096 12-13 02:16 oswtop
drwxr-xr-x 2 root root 4096 12-13 02:16 oswvmstat

3、停止监控器

停止osw就是在其它终端运行stopOSW.sh脚本

例如:

[root@linux osw]# cd /u01/app/osw/
[root@linux osw]# pwd
/u01/app/osw
[root@linux osw]# ./stopOSW.sh 

4、生成图形

[root@linux ~]# cd /u01/app/osw/
[root@linux osw]# pwd
/u01/app/osw
[root@linux osw]# java -jar oswg.jar -i ./archive/

Starting OSWg V3.0.1
OSWatcher Graph Written by Oracle Center of Expertise
Copyright (c)  2008 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file linux_iostat_11.12.13.0500.dat ...
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: 12月 13日 星期二 CST
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: 12月 13日 星期二 CST
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: 12月 13日 星期二 CST
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: 12月 13日 星期二 CST
Timestamp Error. Expected format: May 3 16:11:12 2006.
Timestamp Error. Found format: 12月 13日 星期二 CST

Parsing file linux_vmstat_11.12.13.0500.dat ...
An exception occured in insertVmstatLists on line 6
An exception occured in insertVmstatLists on line 12
An exception occured in insertVmstatLists on line 18
An exception occured in insertVmstatLists on line 24
An exception occured in insertVmstatLists on line 30

No data found in input archive directory ./archive/
Please rerun OSWg with proper input directory containing OSW archive data.
Program aborting...
在生成图形界面的时候报错了,注意Timestamp Error. 产生这个错误的原因就是我的操作系统是中文环境的,osw要英文日期格式才可以。
[root@linux osw]# echo $LANG
zh_CN.GB18030
[root@linux osw]# date
2011年 12月 13日 星期二 05:03:13 CST
下面删除archive目录,改为英文环境就可以了:
[root@linux osw]# LANG=C
[root@linux osw]# date
Tue Dec 13 05:03:47 CST 2011
[root@linux osw]# rm -rf archive/
[root@linux osw]# ./startOSW.sh 10 1
[root@linux osw]# 

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.

Discovery completed.

Starting OSWatcher v3.0.2   on Tue Dec 13 05:04:06 CST 2011
With SnapshotInterval = 10
With ArchiveInterval = 1

OSWatcher - Written by Carl Davis, Center of Expertise, Oracle Corporation

Starting Data Collection...

osw heartbeat:Tue Dec 13 05:04:06 CST 2011
osw heartbeat:Tue Dec 13 05:04:16 CST 2011
osw heartbeat:Tue Dec 13 05:04:26 CST 2011
osw heartbeat:Tue Dec 13 05:04:37 CST 2011
osw heartbeat:Tue Dec 13 05:04:48 CST 2011
接着停止监控:
[root@linux osw]# ./stopOSW.sh
生成图形界面:
[root@linux osw]# java -jar oswg.jar -i ./archive/

Starting OSWg V3.0.1
OSWatcher Graph Written by Oracle Center of Expertise
Copyright (c)  2008 by Oracle Corporation

Parsing Data. Please Wait...

Parsing file linux_iostat_11.12.13.0500.dat ...

Parsing file linux_vmstat_11.12.13.0500.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 Q to Quit Program

Please Select an Option:
图形界面可以借助xmanger,如果服务器有图形界面那更好了,也可以生成报告!

你可能感兴趣的:(oracle系统监控工具oswatch简介!)