--------------
使用oracle的osw工具,可以对系统的CPU和内存,磁盘等进行图形化的展示,对于把握和了解整体的资源使用情况,具有直观的效果。
OSW工具由一系列shell脚本构成,
OSWatcher.sh是主调程序,派生出许多单个的shell进程,使用unix的操作系统诊断工具,来收集特定类型的数据
OSW调用特定的操作系统工具,每个工具作为一个特定的后台进程,进行数据收集。
一般而言支持下述工具:
ps
top
mpstat
iostat
netstat
traceroute
vmstat
输出结果可以进行图形化的展示,当然,也可以使用shell脚本对收集的archive信息进行处理。
--------------
2. 支持平台
--------------
OSW可以运行于下述平台之上:
AIX
Tru64
Solaris
HP-UX
Linux
这个工具要去METLINKE上下载 不过可以到本人的资源上下载付5分而已
http://download.csdn.net/detail/zengmuansha/4606389
这个工具可以在Oracle用户下安装,不必要在root下
Oracle] tar -xvf osw301.tar
>cd osw
4. 启动与停止
--------------
./startOSW.sh 60 10
./stopOSW.sh
nohup ./startOSW.sh 60 10 &
60:数据收集的间隔,以秒为单位
10: 数据收集多长时间,以小时为单位
5. 图形化输出展示
[oracle@node1 osw]$ java -jar oswg.jar -i archive/
Warning: -jar not understood. Ignoring.
Exception in thread "main" java.lang.NoClassDefFoundError: oswg.jar
at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
at __gcj_personality_v0 (/opt/oracle/database/admin/dbsrcipt/osw/java.version=1.4.2)
at __libc_start_main (/lib/tls/libc-2.3.4.so)
at _Jv_RegisterClasses (/opt/oracle/database/admin/dbsrcipt/osw/java.version=1.4.2)
先要检查JAVA版本
# java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20050609 (JIT enabled: jitc))
/usr/bin/java
----10g运行前执行:
[oracle@node10g ~] $ export PATH=$ORACLE_HOME/jre/1.4.2/bin:$PATH
----11g运行前执行:
[oracle@node11g ~]$ export PATH=$ORACLE_HOME/jdk/jre/bin:$PATH
[oracle@node1 osw]$ java -jar oswg.jar -iarchive/
Starting OSWg V3.0.1
OSWatcher Graph Written by Oracle Centerof Expertise
Copyright (c) 2008 by Oracle Corporation
Parsing Data. Please Wait...
Parsing file node1_vmstat_12.09.28.1100.dat...
Invalid data found on line 8
Parsing file node1_vmstat_12.09.28.1700.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 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter L to Specify Alternate Location ofGif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently DisplayedGraphs
Enter P to Generate A Profile
Enter Q to Quit Program
Please Select an Option:6
Xlib: connection to ":0.0"refused by server
Xlib: No protocol specified
Exception in thread "main"java.lang.InternalError: Can't connect to X11 window server using ':0.0' as thevalue of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(UnknownSource)
at java.awt.Window.init(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at OSWGraph.GraphObject.graphMetric(GraphObject.java:145)
at OSWGraph.OSWGraph.main(OSWGraph.java:616)
编辑环境变量
[root@node1 ~]# vi /home/oracle/.bash_profile
export DISPLAY=192.168.30.42:0.0 --指客户端IP
[root@node1 ~]# source /home/oracle/.bash_profile
[root@node1 ~]# su - oracle
[oracle@node1 osw]$ java -jar oswg.jar -iarchive/
Starting OSWg V3.0.1
OSWatcher Graph Written by Oracle Centerof Expertise
Copyright (c) 2008 by Oracle Corporation
Parsing Data. Please Wait...
Parsing file node1_vmstat_12.09.28.1100.dat...
Invalid data found on line 8
Parsing file node1_vmstat_12.09.28.1700.dat...
Parsing Completed.
--输入参数 分别输出不同类型的GIF
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 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter L to Specify Alternate Location ofGif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently DisplayedGraphs
Enter P to Generate A Profile
Enter Q to Quit Program
Please Select an Option:6
Generating filegif/Sep28171028_1348827319/OSWg_OS_Run_Queue.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Block_Queue.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_Idle.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_System.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_User.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_Interrupts.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Context_Switches.gif
在GIF目录下生成了GIF图形 要拖到WINDOWS来看
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 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter L to Specify Alternate Location ofGif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently DisplayedGraphs
Enter P to Generate A Profile
Enter Q to Quit Program