Özet: DBA’lere Oracle veritabanlarının kurulu olduğu ortamın, tüm kaynak kullanım istatistiklerini toplayan “oswatcher tool”unun kullanımını göstermek.

 

OSWatcher, Oracle veritabanı sunucusunun CPU, DISK, Memory.. gibi kaynak kullanımlarının istatiksel bilgilerini toplar ve grafiksel olarak sunar. Bu tool belirli aralıklarla (default 30 saniye) ps, top, vmstat, iostat gibi Linux/Unix komutlarını kullanarak log toplar.

En altta referans bölümünde belirtilen Oracle metalink dokümanından son versiyonunu indirebilirsiniz.
İndirdiğimiz oswatcher tool’unu oracle home u altında kopyalayıp tar ile açıyoruz:

[oracle@testsrv ~]$ cp /backup/oswbb734.tar /home/oracle
[oracle@testsrv ~]$ ls -la
total 108932
drwx------. 7 oracle oinstall 4096 Apr 8 21:35 .
-rw-r--r-- 1 oracle oinstall 6318080 Apr 8 21:35 oswbb734.tar
[oracle@testsrv ~]$ tar xvf oswbb734.tar

[oracle@testsrv ~]$ ls -la
total 108932
drwx------. 7 oracle oinstall 4096 Apr 8 21:35 .
drwxr-xr-x 6 oracle oinstall 4096 Jul 26 2016 oswbb
-rw-r--r-- 1 oracle oinstall 6318080 Apr 8 21:35 oswbb734.tar

oswbb dizini altında çalıştırıyorum:

[oracle@testsrv oswbb]$ sh startOSWbb.sh 30 720
[oracle@testsrv oswbb]$ Setting the archive log directory to/home/oracle/oswbb/archive

Testing for discovery of OS Utilities...
VMSTAT found on your system.
IOSTAT found on your system.
MPSTAT found on your system.
IFCONFIG 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 = 8

Discovery completed.

Starting OSWatcher v7.3.3 on Sat Apr 8 21:39:31 +03 2017
With SnapshotInterval = 30
With ArchiveInterval = 720

OSWatcher - 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:Sat Apr 8 21:39:36 +03 2017
oswbb heartbeat:Sat Apr 8 21:40:06 +03 2017
oswbb heartbeat:Sat Apr 8 21:40:36 +03 2017
oswbb heartbeat:Sat Apr 8 21:41:06 +03 2017
...

Tek seferlik çalıştırmak için:

sh startOSWbb.sh

Arka planda belirli bir zamana kadar çalıştırmak için; örneğin 30 saniye aralıkla 30 gün boyunca çalıştırmak için:

[oracle@testsrv oswbb]$ nohup sh startOSWbb.sh 30 720 &
[oracle@testsrv oswbb]$ ps -ef |grep -i osw
oracle 26589 1 0 22:04 pts/6 00:00:00 /bin/sh ./OSWatcher.sh 30 720
oracle 26685 26589 0 22:05 pts/6 00:00:00 /bin/sh ./OSWatcherFM.sh 720 /home/oracle/oswbb/archive
oracle 27016 15544 0 22:06 pts/6 00:00:00 grep -i osw

Archive dizini altında farklı kaynakların kullanımlarını ayrı ayrı klasörlerde loglar:

[oracle@testsrv oswbb]$ cd /home/oracle/oswbb/archive
[oracle@testsrv archive]$ ls -la
total 48
drwxr-xr-x 12 oracle oinstall 4096 Apr 8 21:39 .
drwxr-xr-x 10 oracle oinstall 4096 Apr 8 22:04 ..
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswifconfig
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswiostat
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswmeminfo
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswmpstat
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswnetstat
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 21:39 oswprvtnet
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswps
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswslabinfo
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswtop
drwxr-xr-x 2 oracle oinstall 4096 Apr 8 22:00 oswvmstat

Yada OSWatcher’ ı 60 sn aralıkla ve 3 gün boyunca(3*24=72 saat) archive tutacak şekilde, sıkıştırarak kurgulayabiliriz;

OSW_DIRECTORY = /u01/oswatcher/oswbb
OSW_DATA DIRECTORY = /u01/oswatcher/data
OSW_START_COMMAND = nohup sh startOSWbb.sh 60 72 gzip /u01/oswatcher/data
OSW_INTERNAL = 60 seconds
OSW_RETENTION = 72 hours
OWS_COMPRESSION = gzip

Durdurmak için:

sh stopOSWbb.sh

Belli bir zaman aralığı için aşağıdaki gibi log toplayabiliriz:

[oracle@testsrv ~]# cd /opt/oracle.oswatcher/osw/archive 
[oracle@testsrv archive]# find . -name "*16.11.25.1[0-2]00*" -exec zip /tmp/osw_'hostname -a'_1021.zip {} \; 
 adding: ExadataRDS/testsrv_ExadataRDS_16.11.25.1100.dat.bz2 (deflated 3%)
 adding: ExadataRDS/testsrv_ExadataRDS_16.11.25.1000.dat.bz2 (deflated 7%)
 adding: ExadataRDS/testsrv_ExadataRDS_16.11.25.1200.dat.bz2 (deflated 3%)
 adding: oswvmstat/testsrv_vmstat_16.11.25.1000.dat (deflated 78%)
 adding: oswvmstat/testsrv_vmstat_16.11.25.1200.dat.bz2 (stored 0%)
 adding: oswvmstat/testsrv_vmstat_16.11.25.1100.dat.bz2 (stored 0%)
 adding: oswdiskstats/testsrv_diskststs_16.11.25.1000.dat (deflated 94%)
 adding: oswdiskstats/testsrv_diskststs_16.11.25.1100.dat.bz2 (deflated 1%)
 adding: oswdiskstats/testsrv_diskststs_16.11.25.1200.dat.bz2 (deflated 1%)
 adding: oswnetstat/testsrv_netstat_16.11.25.1200.dat.bz2 (deflated 5%)
 adding: oswnetstat/testsrv_netstat_16.11.25.1100.dat.bz2 (deflated 5%)
 adding: oswnetstat/testsrv_netstat_16.11.25.1000.dat (deflated 89%)
 adding: oswiostat/testsrv_iostat_16.11.25.1200.dat.bz2 (deflated 0%)
 adding: oswiostat/testsrv_iostat_16.11.25.1000.dat (deflated 94%)
 adding: oswiostat/testsrv_iostat_16.11.25.1100.dat.bz2 (deflated 0%)
 adding: oswslabinfo/testsrv_slabinfo_16.11.25.1200.dat.bz2 (deflated 1%)
 adding: oswslabinfo/testsrv_slabinfo_16.11.25.1000.dat (deflated 96%)
 adding: oswslabinfo/testsrv_slabinfo_16.11.25.1100.dat.bz2 (deflated 1%)
 adding: oswmpstat/testsrv_mpstat_16.11.25.1100.dat.bz2 (stored 0%)
 adding: oswmpstat/testsrv_mpstat_16.11.25.1000.dat (deflated 81%)
 adding: oswmpstat/testsrv_mpstat_16.11.25.1200.dat.bz2 (stored 0%)
 adding: oswps/testsrv_ps_16.11.25.1000.dat (deflated 87%)
 adding: oswps/testsrv_ps_16.11.25.1100.dat.bz2 (deflated 13%)
 adding: oswps/testsrv_ps_16.11.25.1200.dat.bz2 (deflated 14%)
 adding: oswmeminfo/testsrv_meminfo_16.11.25.1000.dat (deflated 93%)
 adding: oswmeminfo/testsrv_meminfo_16.11.25.1200.dat.bz2 (deflated 0%)
 adding: oswmeminfo/testsrv_meminfo_16.11.25.1100.dat.bz2 (deflated 0%)
 adding: oswtop/testsrv_top_16.11.25.1100.dat.bz2 (deflated 7%)
 adding: oswtop/testsrv_top_16.11.25.1000.dat.bz2 (deflated 6%)
 adding: oswtop/testsrv_top_16.11.25.1200.dat.bz2 (deflated 6%)
[oracle@testsrv archive]# cd /tmp
[oracle@testsrv tmp]# ls -lrt
total 19264
-rw-r--r-- 1 root oracle 19495376 Nov 29 12:26 osw_hostname-a_1021.zip

CPU, Memory, IO vs. grafiklerini gif formatında çıkarmak için:

[root@testsrv ~]# cd /opt/oracle.oswatcher/osw
[root@testsrv osw]# java -jar oswg.jar -i ./archive/

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

Parsing Data. Please Wait...

Parsing file testsrv.vmstat_16.06.23.0400.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.0500.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.0600.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.0700.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.0800.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.0900.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.1000.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.1100.dat.bz2 ...
Parsing file testsrv.vmstat_16.06.23.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 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory 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:6
Generating file gif/Jun23120358_1466675943/OSWg_OS_Run_Queue.gif
Generating file gif/Jun23120358_1466675943/OSWg_OS_Block_Queue.gif
Generating file gif/Jun23120358_1466675943/OSWg_OS_Cpu_Idle.gif
Generating file gif/Jun23120358_1466675943/OSWg_OS_Cpu_System.gif
Generating file gif/Jun23120358_1466675943/OSWg_OS_Cpu_User.gif
Generating file gif/Jun23120358_1466675943/OSWg_OS_Cpu_Interrupts.gif
Generating file gif/Jun23120358_1466675943/OSWg_OS_Context_Switches.gif


[root@testsrv osw]# cd gif/Jun23120358_1466675943
[root@testsrv Jun23120358_1466675943]# ls -la
total 68
drwxr-xr-x 2 root root 4096 Jun 23 12:59 .
drwx------ 10 root root 4096 Jun 23 12:59 ..
-rw-r--r-- 1 root root 4043 Jun 23 12:59 OSWg_OS_Block_Queue.gif
-rw-r--r-- 1 root root 10696 Jun 23 12:59 OSWg_OS_Context_Switches.gif
-rw-r--r-- 1 root root 5570 Jun 23 12:59 OSWg_OS_Cpu_Idle.gif
-rw-r--r-- 1 root root 9949 Jun 23 12:59 OSWg_OS_Cpu_Interrupts.gif
-rw-r--r-- 1 root root 4456 Jun 23 12:59 OSWg_OS_Cpu_System.gif
-rw-r--r-- 1 root root 5479 Jun 23 12:59 OSWg_OS_Cpu_User.gif
-rw-r--r-- 1 root root 7981 Jun 23 12:59 OSWg_OS_Run_Queue.gif

Detaylı kullanım için indirdiğiniz “oswbb/docs/OSWatcher” dizinindeki “OSWatcherUserGuide.pdf” ini ve alttaki referans dokümanlarını inceleyebilrsiniz.

 

Referans:

OS Watcher User’s Guide (Doc ID 1531223.1)
OSWatcher Analyzer User Guide (Doc ID 461053.1)