# IASr1013.ctl: Collects OAS 10g R3 Information (10.1.3) # $Id: IASr1013.ctl,v 1.10 2015/02/20 15:30:24 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/IASr1013.ctl,v 1.10 2015/02/20 15:30:24 RDA Exp $ # # Change History # 20150220 KRA Improve list management. =head1 NAME OFM:IASr1013 - Collects OAS 10g R3 Information (10.1.3) =head1 DESCRIPTION This module collects Oracle Application Server 10g R3 (10.1.3)-related information (such as Application Server (AS) Control, HTTP Server, ODL, OPMN, LDAP, and SYSMAN). =head1 REPORTS =cut echo tput('bold'),'Processing 0AS 10g R3 (10.1.3) module ...',tput('off') # Initialization import $APACHE_TOP,$ORACLE_HOME var $IAS_VERSION = $arg[0] var $J2EE_TOP = ${GRP.J2EE.D_TOP:''} var $ODL_QUERIES = ${B_ODL_QUERIES:true} var $ODL_SIZE = ${N_ODL_TAIL:65536} var $TAIL = ${DFT.N_TAIL:1000} var $ASSISTANTS_HOME = catDir($ORACLE_HOME,'assistants') var $CLONE_HOME = catDir($ORACLE_HOME,'clone') var $CFGTOOLLOGS_HOME = catDir($ORACLE_HOME,'cfgtoollogs') var $IAS_CONFIG = catDir($ORACLE_HOME,'config') var $IAS_INSTALL = catDir($ORACLE_HOME,'install') var $JAVACACHE_HOME = catDir($ORACLE_HOME,'javacache') var $LDAP_HOME = catDir($ORACLE_HOME,'ldap') var $OPMN_HOME = catDir($ORACLE_HOME,'opmn') var $SYSMAN_HOME = catDir($ORACLE_HOME,'sysman') var $TOPLINK_HOME = catDir($ORACLE_HOME,'toplink') var $ASCONTROL = catDir($ORACLE_HOME,'j2ee','home','applications','ascontrol',\ 'ascontrol','WEB-INF','config') var $OH = verbatim($ORACLE_HOME) var $OH1 = concat('^',$OH,'[\\\/]') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' set $NOT_OWNER_STATEMENT {**Note:** " "The RDA was executed with an operating system user which is different from "the operating system user who installed the Oracle AS 10g. " "Therefore, no information are available in this section. " } # Load the common macros var %HTTPDCONF run OFM:IAS() run RDA:library() # Set the required environment var $bkp = setContext({PERL5LIB => ${ENV.PERL5LIB},\ PERL5OPT => ${ENV.PERL5OPT}}) =head2 Oracle AS 10g Gathers all general Oracle Application Server 10g information. =cut echo tput('bold'),'Gathering Oracle AS 10g Information ...',\ tput('off') toc '1:Oracle AS 10g (',$IAS_VERSION,')' debug ' Inside IASr1013 module, gathering install and configuration information' var @tbl = (grepDir($IAS_INSTALL,'\.(ini|log)','dir'),\ grepDir($IAS_CONFIG,'\.(properties|xml)','dir'),\ grepDir($ASSISTANTS_HOME,'\.log$','dir'),\ grepDir($CFGTOOLLOGS_HOME,'\.(ini|log|properties|xml)','dir'),\ grepDir($CLONE_HOME,'\.log','dir')) pretoc '2:Install and Configuration' call sort_files(3,$TAIL,@tbl) unpretoc debug ' Inside IASr1013 module, gathering AS 10g information' var @IAS_DIR = ('chgip','diagnostics') var @IAS_SUF = ('\.conf$','\.ini$','\.xml$','\.properties$','\.err$','\.log',\ '\~') var @tbl = () loop $dir (@IAS_DIR) {var $dir = catDir($ORACLE_HOME,$dir) if ?testDir('d',$dir) {loop $suf (@IAS_SUF) call push(@tbl,grepDir($dir,$suf,'dir')) } } pretoc '2:AS Information' call sort_files(3,$TAIL,@tbl) unpretoc # Check the user var $uid= getOwner(getToc(true)) var ($pgm) = (grepDir(catDir($ORACLE_HOME,'opmn','bin'),\ '^opmnctl(\.exe)?$','fip')) var $own= getOwner($pgm) if compare('eq',$uid,$own) var $NOT_OWNER = false else {var $NOT_OWNER = true echo tput('reverse'),'Warning:' echo '========' echo 'The RDA is started as userid: ',$uid echo 'The Oracle AS 10g (',$IAS_VERSION,') was installed on your system \ using userid: ',nvl($own,'[not found]') echo 'The RDA script will continue, but it will skip some AS 10g RDA steps.',\ tput('off') } =head2 AS Control Gathers AS Control information. =cut echo tput('bold'),'Gathering AS Control Information ...',tput('off') debug ' Inside IASr1013 module, gathering AS Control Information' pretoc '%SPLIT%' pretoc '1+:AS Control' call sort_files(3,$TAIL,grepDir($ASCONTROL,'^[^\.]','pn')) unpretoc 2 =head2 DMS Collects a F dump and provides a starting point for analyzing performance issues. =cut echo tput('bold'),'Gathering DMS Information ...',tput('off') toc '%SPLIT%' toc '1+:DMS' report dmstool_dump write '---+ dmstool Dump' if $NOT_OWNER write $NOT_OWNER_STATEMENT else {var $pgm = catCommand($ORACLE_HOME,'bin','dmstool') call writeCommand(concat($pgm,' -dump')) } toc '2:[[',getFile(),'][rda_report][dmstool Dump]]' =head2 HTTP Server Gathers HTTP server information. Collects performance-related information using the following commands: =over 4 =item o C =item o C =item o C =item o C =item o C =back =cut echo tput('bold'),'Gathering HTTP Server Information ...',tput('off') toc '%SPLIT%' toc '1+:HTTP Server' report apache_bin var $dir = catDir($APACHE_TOP,'bin') prefix write '---+ List of Files in ',encode($dir) call statDir('an',$dir) if isCreated(true) {toc '2:Generic' toc '3:[[',getFile(),'][rda_report][',encode(addSymbol($dir)),']]' } debug ' Inside IASr1013 module, getting Apache configuration' call httpServer_getListenerConf() debug ' Inside IASr1013 module, getting Apache log files' call httpServer_getListenerLogs() debug ' Inside IASr1013 module, getting start scripts' call httpServer_getStartScripts() debug ' Inside IASr1013 module, getting mod_plsql configuration' call httpServer_getModplsqlConf() debug ' Inside IASr1013 module, getting JServ configuration' call httpServer_getJServConf() debug ' Inside IASr1013 module, getting JServ log files' call httpServer_getJServLogs() debug ' Inside IASr1013 module, getting JServ Java version' call httpServer_getJServJavaVersions() # Collect Oracle HTTP server performance metrics if !$NOT_OWNER {var $pgm = catCommand($ORACLE_HOME,'bin','dmstool') debug ' Inside IASr1013 module, gathering HTTP server metrics' report dmstool_ohs_server var $cmd = concat($pgm,' -table ohs_server -c 1') prefix {write '---+ HTTP Server Metrics Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][HTTP Server Metrics]]' debug ' Inside IASr1013 module, gathering response metrics' report dmstool_ohs_responses var $cmd = concat($pgm,' -table ohs_responses -c 1') prefix {write '---+ HTTP Server Response Metrics Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Response Metrics]]' debug ' Inside IASr1013 module, gathering activity per module' report dmstool_ohs_module var $cmd = concat($pgm,' -table ohs_module -c 1') prefix {write '---+ HTTP Server Activity per Module Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Activity per Module]]' debug ' Inside IASr1013 module, gathering activity per virtual host' report dmstool_ohs_virtualhost var $cmd = concat($pgm,' -table ohs_virtualHost -c 1') prefix {write '---+ HTTP Server Activity per Virtual Host Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Activity per Virtual Host]]' debug ' Inside IASr1013 module, gathering activity per child server' report dmstool_ohs_child var $cmd = concat($pgm,' -table ohs_child -c 1') prefix {write '---+ HTTP Server Activity per Child Server Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Activity per Child Server]]' } =head2 JAVACACHE Gathers Java Object Cache information. =cut if ?testDir('d',$JAVACACHE_HOME) {echo tput('bold'),'Gathering JAVACACHE Information ...',tput('off') pretoc '%SPLIT%' pretoc '1+:JAVACACHE' debug ' Inside IASr1013 module, gathering JAVACACHE information' call sort_files(2,$TAIL,grepDir($JAVACACHE_HOME,'\.log','inr'),\ grepDir($JAVACACHE_HOME,'\.xml','inr')) =head2 javacache - Java Cache Gathers Java Cache command information. =cut var $fil = catFile($JAVACACHE_HOME,'lib','cache.jar') if ?testFile('f',$fil) {debug ' Inside IASr1013 module, gathering JAVACACHE command information' var $tmp = createTemp('javacache') call writeTemp('javacache','lc') call writeTemp('javacache','lo') call closeTemp('javacache') var $cmd = concat(catCommand($ORACLE_HOME,'jdk','bin','java'),\ ' -jar ',quote($fil),' watch <',$tmp) report javacache prefix {write '---+!! Java Cache Command Execution' write '---## Using: cache.jar lc and lo commands' } call writeCommand($cmd) if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Java Cache]]' } call unlinkTemp('javacache') } =head2 diskcache - Java DiskCache Gathers Java DiskCache information. =cut var $dir = catDir($JAVACACHE_HOME,'DiskCache') if ?testDir('d',$dir) {debug ' Inside IASr1013 module, gathering Java DiskCache information' report diskcache prefix {write '---+!! Java DiskCache Information' write '---+ List of Files in ',encode($dir) } call statDir('an',$dir) if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Java DiskCache]]' } } unpretoc 2 } =head2 LDAP Gathers LDAP information. Not every Oracle Application Server 10g installation has an LDAP directory. =cut if ?testDir('d',$LDAP_HOME) {echo tput('bold'),'Gathering LDAP Information ...',tput('off') pretoc '%SPLIT%' pretoc '1+:LDAP' debug ' Inside IASr1013 module, gathering LDAP information' var $dir = catDir($LDAP_HOME,'bin') if ?testDir('d',$dir) {report ldap_bin prefix write '---+ List of Files in ',encode($dir) call statDir('an',$dir) if isCreated(true) {toc '2:Generic' toc '3:[[',getFile(),'][rda_report][',encode(addSymbol($dir)),']]' } } if grepDir($LDAP_HOME,'\.log','ir') {var (@fil,%dir) = (last) loop $fil (@fil) var $dir{dirname($fil)} = true report ldap_log write '---+!! List of LDAP Log Files' write $TOC loop $dir (keys(%dir)) {write '---++ List of Files in ',encode($dir) call statDir('at',$dir) write $TOP } toc '2:[[',getFile(),'][rda_report][LDAP Log Files]]' call sort_files(3,$TAIL,@fil) } unpretoc 2 } =head2 ODL Gathers Oracle Diagnostics Logging (ODL) information. It collects utilization over the last 24 hours, with warnings and errors from components that are enabled for ODL. =cut if !$NOT_OWNER {echo tput('bold'),'Gathering ODL Information ...',tput('off') pretoc '%SPLIT%' pretoc '1+:ODL Diagnostics' if $ODL_QUERIES {var $pgm = concat(catCommand($ORACLE_HOME,'jdk','bin','java'),\ ' -classpath ',\ catCommand($ORACLE_HOME,'diagnostics','lib','ojdl2.jar'),\ ' oracle.core.ojdl.loader.PrintLogs -registration ',\ catCommand($ASCONTROL,'registration'),\ ' -home ',quote($ORACLE_HOME)) # Get utilization over last 24 hours debug ' Inside IASr1013 module, getting activities over last 24 hours' report odl_24h prefix write '---+!! Activities over last 24 Hours' call writeCommand(concat($pgm,\ ' -last 1d -count COMPONENT_ID MODULE_ID MSG_TYPE 2>&1')) call writeCommand(concat($pgm,\ ' -last 1d -count TSTZ_ORIGINATING 2>&1')) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Activities over last 24 Hours]]' # Get warnings and errors from components which are enabled for ODL loop $cmp (command(concat($pgm,' -last 1d -count COMPONENT_ID'))) {var $cmp = field(',',0,$cmp) debug ' Inside IASr1013 module, getting last warnings and errors from ',$cmp report concat('odl_comp_',$cmp) prefix write '---+ Last Warnings and Errors from ',$cmp if isUnix() call writeCommand(concat($pgm,' -query \( COMPONENT_ID -eq ',quote($cmp),\ ' \) -and \( MSG_TYPE -eq ERROR -or MSG_TYPE -eq WARNING \) -text_full \ -tail ',$TAIL,' -notailopt 2>&1')) else call writeCommand(concat($pgm,' -query ( COMPONENT_ID -eq ',quote($cmp),\ ' ) -and ( MSG_TYPE -eq ERROR -or MSG_TYPE -eq WARNING ) -text_full \ -tail ',$TAIL,' -notailopt 2>&1')) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Last Warnings and Errors from ',$cmp,\ ']]' } } =head2 odl_log - HTTP Server Log File Gathers HTTP Server Oracle Diagnostics Logging (ODL) information. This new method for reporting diagnostic messages presents a common format for diagnostic messages and log files, and a mechanism for correlating all diagnostic messages from various components across Oracle Application Server. =cut debug ' Inside IASr1013 module, gathering HTTP Server ODL logging' call httpServer_getOdlLog(false) =head2 J2EE ODL Log Files Gathers J2EE ODL Diagnostics information. =cut if ?testDir('dr',$J2EE_TOP) {# Define a macro to gather the directory list for odl logs macro get_odl_logdir {var ($flg,$pth) = @arg import $ins,$bas,%dir if isAbsolute($pth) var $dir{$pth} = true else {var @fil = grepDir(cond($flg,$bas,catDir($ins,'log')),'^log\d*\.xml$','irt') loop $fil (@fil) var $dir{dirname($fil)} = true } } # Defeine a macro to gather the log file path for OC4J instance macro get_oc4j_logdir {var ($flg,@cfg) = @arg loop $fil (@cfg) {if ?testFile('r',$fil) {var $obj = xmlLoadFile($fil,xmlDisable(xmlParser(),'R')) if xmlFind($obj,'.../log/odl') call get_odl_logdir($flg,xmlValue(last,'path')) } } } # Extract the oc4j log directories from each instance var (%dir,%log) = () debug ' Inside IASr1013 module, gathering J2EE ODL logging' loop $nam (grepDir($J2EE_TOP,'^[\.]+$','v')) {next !?testDir('d',catDir($J2EE_TOP,$nam)) var $ins = catDir($J2EE_TOP,$nam) if ?testFile('r',catFile($ins,'config','j2ee-logging.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'R')) loop $xml (xmlFind($obj,'.../log_handler name="oc4j-handler"')) {next !xmlFind($xml,'property name="rotationFrequency"') var $pth = xmlValue(xmlFind($xml,'property name="path"'),'value') call get_odl_logdir(false,$pth) } } var $bas = catDir($ins,'application-deployments') call get_oc4j_logdir(true,grepDir($bas,'^orion\-application\.xml$','ir',2)) call get_oc4j_logdir(false,\ catFile($ins,'config','application.xml'),\ catFile($ins,'config','default-web-site.xml'),\ catFile($ins,'config','server.xml'),\ catFile($ins,'config','jms.xml'),\ catFile($ins,'config','rmi.xml')) } # Collect the 2 most recent log files from each log directory pretoc '2:J2EE ODL Log Files' loop $dir (keys(%dir)) {var $cnt = 2 loop $fil (grepDir($dir,'^log\d*\.xml$','ipt')) {next $log{$fil} var $log{$fil} = true decr $cnt break !$cnt } } call sort_files(3,0,keys(%log)) unpretoc } unpretoc 2 } =head2 OPMN Gathers OPMN information. It finds all C<*.log>, C<*.conf>, and C<*.xml> files. =cut echo tput('bold'),'Gathering OPMN Information ...',tput('off') toc '%SPLIT%' toc '1+:OPMN' debug ' Inside IASr1013 module, getting OPMN information' report opmn_bin var $dir = catDir($OPMN_HOME,'bin') prefix write '---+ List of Files in ',encode($dir) call statDir('an',$dir) if isCreated(true) {toc '2:Generic' toc '3:[[',getFile(),'][rda_report][',encode(addSymbol($dir)),']]' } if $NOT_OWNER {report no_opmnctl write '---+ opmnctl' write $NOT_OWNER_STATEMENT toc '2:[[',getFile(),'][rda_report][opmnctl]]' } else {toc '2:opmnctl' var $pgm = catCommand($dir,'opmnctl') report opmnctl_status write '---+ opmnctl status' var $fmt = '%cmp18%prt18%pid7R%sta8%utm9R%mem8R%por' var $cmd = concat($pgm,' status -fmt ',$fmt,' 2>&1') write '---## Using: ',encode($cmd) call writeCommand($cmd) toc '3:[[',getFile(),'][rda_report][opmnctl status]]' report opmnctl_status_app write '---+ opmnctl status -app' var $cmd = concat($pgm,' status -app 2>&1') write '---## Using: ',encode($cmd) call writeCommand($cmd) toc '3:[[',getFile(),'][rda_report][opmnctl status -app]]' report opmnctl_debug_pm write '---+ opmnctl debug comp=pn' var $cmd = concat($pgm,' debug comp=pm 2>&1') write '---## Using: ',encode($cmd) call writeCommand($cmd) toc '3:[[',getFile(),'][rda_report][opmnctl debug comp=pn]]' report opmnctl_debug_ons write '---+ opmnctl debug comp=ons' var $cmd = concat($pgm,' debug comp=ons 2>&1') write '---## Using: ',encode($cmd) call writeCommand($cmd) toc '3:[[',getFile(),'][rda_report][opmnctl debug comp=ons]]' } # Identify the custom locations for OC4J instances var @tbl = () if ?testFile('r',catFile($OPMN_HOME,'conf','opmn.xml')) {var ($top,%pth) = (xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'DR'))) loop $xml (xmlFind($top,\ 'opmn/process-manager/ias-instance/ias-component/process-type \ module-id="OC4J"/module-data/category id="start-parameters"/data \ id="^(java|oc4j)-options$"')) {var $str = xmlValue($xml,'value') if match($str,'(\A|\s)-out\s+(\S+)') var $pth{catFile(last->[1])} = 1 if match($str,'(\A|\s)-err\s+(\S+)') var $pth{catFile(last->[1])} = 2 } loop $pth (keys(%pth)) {var ($dir,$nam) = parsePath($pth) call push(@tbl,grepDir($dir,concat('^',verbatim($nam),'$'),'ir',1)) } } # Collect the files pretoc '2:OPMN' call sort_files(3,$TAIL,grepDir($OPMN_HOME,'\.conf$','ir'),\ grepDir($OPMN_HOME,'\.xml','ir'),\ grepDir(catDir($OPMN_HOME,'logs'),'.','ir'),\ @tbl) unpretoc =head2 SYSMAN Gathers SYSMAN information. =cut echo tput('bold'),'Gathering SYSMAN Information ...',tput('off') toc '%SPLIT%' toc '1+:SYSMAN' debug ' Inside IASr1013 module, gathering SYSMAN information' call sort_files(2,$TAIL,grepDir($SYSMAN_HOME,'\.(log|properties|xml)','inr'),\ grepDir(catDir($SYSMAN_HOME,'config'),'^[^\.]','pn'),\ grepDir(catDir($SYSMAN_HOME,'log'),'^[^\.]','pn')) =head2 TOPLINK Gathers TOPLINK information. =cut if ?testDir('d',$TOPLINK_HOME) {echo tput('bold'),'Gathering TOPLINK Information ...',tput('off') toc '%SPLIT%' toc '1+:TOPLINK' debug ' Inside IASr1013 module, gathering TOPLINK information' call sort_files(2,$TAIL,grepDir($TOPLINK_HOME,'\.log','inr'),\ grepDir($TOPLINK_HOME,'\.xml','inr')) } =head2 HCVE When requested, performs the preinstallation checks. =cut # Collect HCVE information when requested if and(${B_HCVE_CHECKS},match(getOsName(),'linux')) {debug ' Inside IASr1013 module, executing the preinstallation checks' test TOOL:TLhcve('OFM:Aoas1013_lin') } # Restore the previous environment call restoreContext($bkp) =head1 SEE ALSO L, L =begin credits =over 10 =item RDA 4.2: Michael Ferrante, Greg Cook, Joerg Doerries, Sunil Hingorani. =item RDA 4.5: Greg Cook, Harpal Kochar, Marty Grinstead, Ranga Polisetti. =item RDA 4.6: Takayuki Hamaguchi, Ian Reid. =item RDA 4.8: Prag Padmaraj, Sudip Roy. =item RDA 4.9: Marcus Lachmanez. =item RDA 4.10: Daniel Mortimer. =item RDA 4.11: Daniel Mortimer. =item RDA 4.22: Miguel Hernandez, Daniel Mortimer, Albert Girona Puig. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut