OSWbb是收集數據,OSWbba 是分析數據,在OSWbb4.0以后,OSWbba已經綁定在OSWbb內。
1.創建目錄,上傳/解壓安裝包
[oracle@std ~]$ mkdir oswbb [oracle@std ~]$ mv oswbb732.tar oswbb [oracle@std ~]$ cd oswbb/ [oracle@std oswbb]$ ls oswbb732.tar oracle@std oswbb]$ tar -xvf oswbb732.tar oswbb/ oswbb/data/ oswbb/docs/ oswbb/docs/The_Analyzer/ oswbb/docs/The_Analyzer/OSWatcherAnalyzerOverview.pdf oswbb/docs/The_Analyzer/oswbbaUserGuide.pdf oswbb/docs/The_Analyzer/oswbba_README.txt oswbb/docs/OSWatcher/ oswbb/docs/OSWatcher/oswbb_README.txt oswbb/docs/OSWatcher/OSWatcherUserGuide.pdf oswbb/Exampleprivate.net oswbb/nfssub.sh oswbb/stopOSWbb.sh oswbb/call_du.sh oswbb/iosub.sh oswbb/profile/ oswbb/OSWatcherFM.sh oswbb/ifconfigsub.sh oswbb/ltop.sh oswbb/mpsub.sh oswbb/call_uptime.sh oswbb/gif/ oswbb/psmemsub.sh oswbb/tar_up_partial_archive.sh oswbb/oswnet.sh oswbb/vmsub.sh oswbb/call_sar.sh oswbb/oswib.sh oswbb/startOSWbb.sh oswbb/Example_extras.txt oswbb/oswsub.sh oswbb/analysis/ oswbb/oswbba.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 [oracle@std oswbb]$ ls oswbb oswbb732.tar
OSWBB目錄結構
[oracle@std oswbb]$ tree . |-- Example_extras.txt |-- Exampleprivate.net |-- OSWatcher.sh |-- OSWatcherFM.sh |-- analysis |-- call_du.sh |-- call_sar.sh |-- call_uptime.sh |-- data |-- docs | |-- OSWatcher | | |-- OSWatcherUserGuide.pdf | | `-- oswbb_README.txt | `-- The_Analyzer | |-- OSWatcherAnalyzerOverview.pdf | |-- oswbbaUserGuide.pdf | `-- oswbba_README.txt |-- gif |-- ifconfigsub.sh |-- iosub.sh |-- locks |-- ltop.sh |-- mpsub.sh |-- nfssub.sh |-- oswbba.jar |-- oswib.sh |-- oswnet.sh |-- oswrds.sh |-- oswsub.sh |-- profile |-- psmemsub.sh |-- src | |-- OSW_profile.htm | |-- Thumbs.db | |-- coe_logo.gif | |-- missing_graphic.gif | |-- oswbba_input.txt | |-- tombody.gif | `-- watch.gif |-- startOSWbb.sh |-- stopOSWbb.sh |-- tar_up_partial_archive.sh |-- tarupfiles.sh |-- tmp |-- topaix.sh |-- vmsub.sh `-- xtop.sh
2.啟動OSWbb
啟動 OSWbb 實用程序,可以直接在 OSWbb 的安裝目錄下執行 startOSWbb.sh shell 腳本,
該腳本一共有4個參數,其中兩個為可選參數,他們分別是:
$1 = 快照間隔,以秒為單位。
$2 = 要存儲的歸檔數據的小時數。
$3 = (可選)壓縮工具的名稱,可以自動將生成的文件進行壓縮。
$4 = (可選)保存歸檔的非默認路徑,改參數用於替換OSWBB_ARCHIVE_DEST環境變量,
如果不設置這個參數oswbb將尋找環境變量OSWBB_ARCHIVE_DEST。 如果都沒有設置的話,就會用默認的歸檔目錄
示例 1:不輸入任何參數啟動時,則會以 30 秒間隔來收集數據,將每個小時的數據記錄到一個歸檔文件,並自動刪除48小時前的歸檔文件
./startOSWbb.sh
示例 2:這將啟動時,以 60 秒間隔來收集數據,將每個小時的數據記錄到一個歸檔文件,自動刪除10小時前的歸檔文件,並且自動壓縮文件。
./startOSWbb.sh 60 10 gzip
示例 3:這將啟動時,以 60 秒間隔來收集數據,將每個小時的數據記錄到一個歸檔文件,自動刪除10小時前的歸檔文件,自動壓縮文件,並且保存到一個非默認路徑下。
./startOSWbb.sh 60 10 gzip /u02/tools/oswbb/archive
示例 5:以nohup啟動時,將進程置於后台運行,允許工具在會話被終止后繼續運行,以 60 秒間隔收集數據,將每個小時的數據記錄到一個歸檔文件, 並自動刪除10小時前的歸檔文件。
nohup ./startOSWbb.sh 60 10 &
注意
啟動oswbb之前必須設置OS的LANG環境變量為英文環境,要不然oswbba的時候無法分析
~]# export LANG=zh_US
~]# date #通過date的輸出結果,查看語言環境
Fri Jan 3 20:56:15 CST 2014
[oracle@std oswbb]$ ./startOSWbb.sh 60 10 gzip /home/oracle/oswbb/archive/ [oracle@std oswbb]$ Info...Zip option IS specified. Info...OSW will use gzip to compress files. Testing for discovery of OS Utilities... VMSTAT found on your system. IOSTAT found on your system. MPSTAT found on your system. Warning... IFCONFIG not found on your system. No IFCONFIG data will be collected. --因為我們是普通用戶執行的,直接執行ifconfig會找不到該命令 /sbin/ifconfig 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 = 2 Discovery completed. Starting OSWatcher Black Box v7.3.2 on Wed Jan 27 11:30:44 CST 2016 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: /home/oracle/oswbb/archive/ Starting Data Collection... oswbb heartbeat:Wed Jan 27 11:30:49 CST 2016 oswbb heartbeat:Wed Jan 27 11:31:49 CST 2016 oswbb heartbeat:Wed Jan 27 11:32:49 CST 2016 oswbb heartbeat:Wed Jan 27 11:33:49 CST 2016
[oracle@std oswbb]$ ll archive/ total 40 drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswifconfig drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswiostat drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswmeminfo drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswmpstat drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswnetstat drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswprvtnet drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswps drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswslabinfo drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswtop drwxr-xr-x 2 oracle oinstall 4096 Jan 27 11:30 oswvmstat
查看收集到的數據樣例:
[oracle@std archive]$ cd oswiostat/ [oracle@std oswiostat]$ ls std_iostat_16.01.27.1100.dat [oracle@std oswiostat]$ cat std_iostat_16.01.27.1100.dat Linux OSWbb v7.3.2 zzz ***Wed Jan 27 11:30:49 CST 2016 avg-cpu: %user %nice %system %iowait %steal %idle 1.02 0.00 1.02 0.51 0.00 97.46 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 4.00 0.00 52.00 0.00 26.00 0.02 4.75 4.75 1.90 sda1 0.00 0.00 4.00 0.00 52.00 0.00 26.00 0.02 4.75 4.75 1.90 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 zzz ***Wed Jan 27 11:31:49 CST 2016 avg-cpu: %user %nice %system %iowait %steal %idle 0.51 0.00 1.52 14.21 0.00 83.76 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 82.00 0.00 22.00 0.00 484.00 44.00 0.96 45.00 12.95 28.50 sda1 0.00 82.00 0.00 22.00 0.00 484.00 44.00 0.96 45.00 12.95 28.50 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 zzz ***Wed Jan 27 11:32:49 CST 2016 avg-cpu: %user %nice %system %iowait %steal %idle 0.51 0.00 1.01 0.00 0.00 98.48 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 zzz ***Wed Jan 27 11:33:49 CST 2016 avg-cpu: %user %nice %system %iowait %steal %idle 0.50 0.00 1.51 1.51 0.00 96.48 Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 6.00 0.00 2.00 0.00 32.00 32.00 0.03 14.50 14.50 2.90 sda1 0.00 6.00 0.00 2.00 0.00 32.00 32.00 0.03 14.50 14.50 2.90 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
4.停止oswbb
[oracle@std oswbb]$ ./stopOSWbb.sh [oracle@std oswbb]$ ps -ef|grep oswbb |grep -v grep
5.后台啟動oswbb
[oracle@std oswbb]$ nohup ./startOSWbb.sh 60 10 gzip /home/oracle/oswbb/archive/ 2 >&1 > /home/oracle/oswbb/oswbb.log & [1] 1151 [oracle@std oswbb]$ tail -f ../oswbb.log 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: /home/oracle/oswbb/archive/ Starting Data Collection... oswbb heartbeat:Wed Jan 27 13:54:57 CST 2016 oswbb heartbeat:Wed Jan 27 13:55:57 CST 2016
解釋一下 2 >&1 在 shell 程式中,最常使用的 FD (file descriptor) 大概有三個, 分別是: 0 是一個文件描述符,表示標准輸入(stdin) 1 是一個文件描述符,表示標准輸出(stdout) 2 是一個文件描述符,表示標准錯誤(stderr) 在標准情況下, 這些FD分別跟如下設備關聯: stdin(0): keyboard 鍵盤輸入,並返回在前端 stdout(1): monitor 正確返回值 輸出到前端 stderr(2): monitor 錯誤返回值 輸出到前端 & 是一個描述符,如果1或2前不加&,會被當成一個普通文件 1>&2 意思是把標准輸出重定向到標准錯誤. 2>&1 意思是把標准錯誤輸出重定向到標准輸出。 &>filename 意思是把標准輸出和標准錯誤輸出都重定向到文件filename中
6.owsbba(OS Watcher Black Box Analyzer)分析抓取的數據
我們用OSWatcher 收集了數據存儲到歸檔里,但是這些文件不利於分析,
所以Oracle 提供了OSWbba(OS Watcher Black Box Analyzer)工具,
其可以分析OSWbb收集的數據並用圖表展示出來。
--查看java版本
[oracle@std ~]$ java -version java version "1.4.2" gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)
我們的版本過低,更新JDK環境
[oracle@std ~]$ java -version java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode)
--啟動oswbba
[oracle@std ~]$ su - Password: [root@std ~]# DISPLAY=192.168.1.210:0.0 [root@std ~]# xhost + access control disabled, clients can connect from any host [root@std ~]# exit logout [oracle@std ~]$ java -jar /home/oracle/oswbb/oswbb/oswbba.jar -i /home/oracle/oswbb/archive/ Starting OSW Analyzer V7.3.1 OSWatcher Analyzer Written by Oracle Center of Expertise Copyright (c) 2014 by Oracle Corporation Parsing Data. Please Wait... WARNING. oswbba has detected at least some of the files in you archive have been compressed. These files will not be analyzed. You must uncompress all the files in the archive for full analysis and graphing capabilities. Scanning file headers for version and platform info... Compressed file found. Ignoring std_iostat_16.01.27.1100.dat.gz ... Compressed file found. Ignoring std_iostat_16.01.27.1300.dat.gz ... Compressed file found. Ignoring std_iostat_16.01.27.1100.dat.gz ... Parsing file std_iostat_16.01.27.1200.dat ... Compressed file found. Ignoring std_iostat_16.01.27.1300.dat.gz ... Parsing file std_iostat_16.01.27.1400.dat ... Compressed file found. Ignoring std_vmstat_16.01.27.1100.dat.gz ... Parsing file std_vmstat_16.01.27.1200.dat ... Compressed file found. Ignoring std_vmstat_16.01.27.1300.dat.gz ... Parsing file std_vmstat_16.01.27.1400.dat ... Compressed file found. Ignoring std_netstat_16.01.27.1100.dat.gz ... Parsing file std_netstat_16.01.27.1200.dat ... Compressed file found. Ignoring std_netstat_16.01.27.1300.dat.gz ... Parsing file std_netstat_16.01.27.1400.dat ... Compressed file found. Ignoring std_top_16.01.27.1100.dat.gz ... Parsing file std_top_16.01.27.1200.dat ... Compressed file found. Ignoring std_top_16.01.27.1300.dat.gz ... Parsing file std_top_16.01.27.1400.dat ... Compressed file found. Ignoring std_ps_16.01.27.1100.dat.gz ... Parsing file std_ps_16.01.27.1200.dat ... Compressed file found. Ignoring std_ps_16.01.27.1300.dat.gz ... Parsing file std_ps_16.01.27.1400.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 Alter Graph Time Scale Only (Does not change analysis dataset) Enter D to Return to Default Graph Time Scale Enter R to Remove Currently Displayed Graphs Enter A to Analyze Data Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale) Enter P to Generate A Profile Enter X to Export Parsed Data to File Enter Q to Quit Program Please Select an Option:4 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 Alter Graph Time Scale Only (Does not change analysis dataset) Enter D to Return to Default Graph Time Scale Enter R to Remove Currently Displayed Graphs Enter A to Analyze Data Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale) Enter P to Generate A Profile Enter X to Export Parsed Data to File Enter Q to Quit Program Please Select an Option:
在解壓后的oswbb/docs中可以查看官方幫助文檔。
參考:
http://www.dbaydna.com/oswatcher%E5%9C%A8linux%E7%8E%AF%E5%A2%83%E4%BD%BF%E7%94%A8.html
http://www.cnblogs.com/kaituorensheng/p/3980334.html
http://blog.itpub.net/27000195/viewspace-1415841/