部署Oracle osw(OS Watcher)

Linux操作系统上的IO、内存、CPU变化如何监控呢?Oracle提供的OS Watcher可以帮助我们监控这些数据,不过我们并不能实时的通过图形看到这部分数据的变化,需要通过命令生成图形。虽然有点后知后觉,不过起码也算时“监控”了。
安装方式非常简单,从Oracle官方网站下载osw安装包,解压缩即可。

[[email protected] tmp]# cd osw/
 [[email protected] osw]# ls
 [[email protected] osw]# ls
 osw301.tar
 [[email protected] osw]# tar -xvf osw301.tar
 ./
 ./osw/
 ./osw/Exampleprivate.net
 ./osw/OSWatcher.sh
 ./osw/OSWatcherFM.sh
 ./osw/OSWgREADME.txt
 ./osw/README.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

sow需要用到java,对java的版本有要求。这个要求可能根据osw的版本不同而有区别。我下载的osw包内对java的版本要求为1.4.2以上,我的是1.6.0.

[[email protected] osw]# java -version
 java version "1.6.0"
 OpenJDK Runtime Environment (build 1.6.0-b09)
 OpenJDK Client VM (build 1.6.0-b09, mixed mode)

启动OSW非常简单。只要运行startOSW.sh就可以了。该shell 需要2个参数,第一个参数指定采样时间间隔,第二个指定存储数据的时间。缺省情况下(如果不输入参数),OSW采样以30秒为间隔,存储24小时的数据.
我设置的间隔时间为10秒,保留时间为240小时,生成的log保存在osw目录下的osw.log文件中。

[[email protected] osw]# ./startOSW.sh 10 240 >> osw.log &
 [1] 16589
 [[email protected] osw]#
 [1]+ Done ./startOSW.sh 10 240 >> osw.log
 [[email protected] osw]#
 [[email protected] osw]# cat osw.log
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.1 on Mon Nov 21 15:56:22 CST 2011
 With SnapshotInterval = 10
 With ArchiveInterval = 240
OSWatcher - Written by Carl Davis, Center of Expertise, Oracle Corporation
Starting Data Collection...
osw heartbeat:Mon Nov 21 15:56:22 CST 2011

关闭OSW更加简单,./stopOSW.sh即可。

可使用如下命令生成指定要求的图片。
[[email protected] 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 hpserver_iostat_11.11.21.1500.dat …
Parsing file hpserver_iostat_11.11.21.1600.dat …

Parsing file hpserver_vmstat_11.11.21.1500.dat …
Parsing file hpserver_vmstat_11.11.21.1600.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

附上生成的部分图片:
OSWg dm 0 OS IO PB
OSWg OS Context Switches
OSWg OS Cpu Idle
OSWg OS Memory Swap
OSWg sda OS IO RPS

总结:
Oracle OS Watcher在监控系统CPU、内存、磁盘IO方面非常方便易用,但是收集数据的过程也要占用一定的系统资源。

参考:

Tools:OSW工具-Oracle的OS watcher

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress