# IASr2.ctl: Collects 9iAS R2 Information (9.0.2 or 9.0.3) # $Id: IASr2.ctl,v 1.6 2013/12/19 14:01:29 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/IASr2.ctl,v 1.6 2013/12/19 14:01:29 RDA Exp $ # # Change History # 20131219 KRA Fix spell. =head1 NAME OFM:IASr2 - Collects 9iAS R2 Information (9.0.2 or 9.0.3) =head1 DESCRIPTION This module collects Oracle 9i Application Server R2 (9.0.2 or 9.0.3)-related information (such as DCM, DMS, HTTP Server, LDAP, OPMN, and SYSMAN). =head1 REPORTS =cut echo tput('bold'),'Processing 9iAS R2 (9.0.2 or 9.0.3) module ...',tput('off') # Initialization import $APACHE_TOP,$ORACLE_HOME var $IAS_VERSION = $arg[0] var $DCM_TAIL = ${N_DCM_TAIL:20000} var $RUN_DCMCTL = ${B_RUN_DCMCTL} var $TAIL = ${DFT.N_TAIL:1000} var $DCM_HOME = catDir($ORACLE_HOME,'dcm') var $IAS_CONFIG = catDir($ORACLE_HOME,'config') var $IAS_INSTALL = catDir($ORACLE_HOME,'install') var $LDAP_HOME = catDir($ORACLE_HOME,'ldap') var $OPMN_HOME = catDir($ORACLE_HOME,'opmn') var $SYSMAN_HOME = catDir($ORACLE_HOME,'sysman') var $DCM_DCMCTL_LOG = catDir($DCM_HOME,'logs','dcmctl_logs') var $DCM_DAEMON_LOG = catDir($DCM_HOME,'logs','daemon_logs') var $DCM_EMD_LOG = catDir($DCM_HOME,'logs','emd_logs') 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 9iAS R2. " "Therefore, no information are available in this section. " } # Load the common macros run OFM:IAS() run RDA:library() =head2 9iAS R2 Gathers all general Oracle 9i Application Server information. =cut echo tput('bold'),'Gathering 9iAS Information ...',tput('off') toc '1:9iAS R2 (',$IAS_VERSION,')' call search_files($IAS_CONFIG,'\.properties$',0) call search_files($IAS_CONFIG,'xml$',0) call search_files($IAS_CONFIG,'\.log$',$TAIL) call search_files($IAS_INSTALL,'\.ini$',0) call search_files($IAS_INSTALL,'\.log$',0) # Check the user var $uid= getOwner(getToc(true)) var ($pgm) = (grepDir(catDir($ORACLE_HOME,'opmn','bin'),\ '^opmnadmin(\.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 9iAS was installed on your system using userid: ',\ nvl($own,'[not found]') echo 'Some commands of the 9iAS RDA part must be run by 9iAS (',\ $IAS_VERSION,') owner.',tput('off') } =head2 DCM Collects the last DCM error, the cluster and standalone instance information, the DCM dump, and the log files of the DCM repository. =cut # Collect DCM Information echo tput('bold'),'Gathering DCM Information ...',tput('off') toc '%SPLIT%' toc '1+:DCM' var $pgm = catCommand($ORACLE_HOME,'dcm','bin','dcmctl') if $NOT_OWNER {report not_owner write $NOT_OWNER_STATEMENT toc '2:[[',getFile(),'][rda_report][DCM Repository]]' } else {debug ' Inside IASr2 module, gathering DCM information' if $RUN_DCMCTL {echo ' A complete analysis of the DCM repository using the dcmctl command \ was selected.' echo ' This may take a few minutes. Be patient...' } macro exec_dcmctl {var ($cmd) = @arg var $err = getTemp('ias') write '---## Using: ',encode($cmd) call writeCommand(concat($cmd," 2>",$err)) if ?testFile('s',$err) {write '**Exception from "',encode($cmd),'"**%BR%' call writeFile($err) } call unlinkTemp('ias') } macro get_dcmctl {var ($cmd,$msg) = @arg var $err = getTemp('ias') write '---## Using: ',encode($cmd) call loadCommand(concat($cmd," 2>",$err)) var @tbl = getLines() if @tbl call writeLastFile() elsif $msg write $msg if ?testFile('s',$err) {write '**Exception from "',encode($cmd),'"**%BR%' call writeFile($err) } call unlinkTemp('ias') return @tbl } macro write_dcmctl {var ($cmd) = @arg write '---## Using: ',encode($cmd) call writeCommand($cmd) } =for stopwords dcmctl getError =head2 dcm_error - dcmctl getError Retrieves the last DCM error that occurred before RDA started. =cut debug ' Inside IASr2 module, retrieving the last DCM error' report dcm_error write '---+ 9iAS R2 last error from dcmctl before RDA was started' call write_dcmctl(concat($pgm,' getError -d 2>&1')) toc '2:[[',getFile(),'][rda_report][dcmctl getError]]' =head2 dcm_cluster - DCM Cluster Collects DCM cluster information. For each instance on which clusters are found, RDA gathers information about the components and applications. =cut debug ' Inside IASr2 module, gathering DCM cluster information' report dcm_cluster write '---+!! 9iAS R2 Cluster configuration Information' write $TOC # Check whether there are cluster defined in iAS infrastructure write '---+ List of Clusters' var @DCM_CLUSTERS = get_dcmctl(concat($pgm,' listClusters -d'),\ 'No cluster found.%BR%') write $TOP if $RUN_DCMCTL {# Collect complete dcmctl information about each cluster loop $clu (@DCM_CLUSTERS) {write '---+ Configuration of Cluster: ',$clu write '---++ Instances found in the Cluster' var @DCM_INSTANCES = get_dcmctl(concat($pgm,' listInstances -cl ',\ quote($clu),' -d'),\ 'No instance found.%BR%') write $TOP write '---++ State of the Cluster' call exec_dcmctl(concat($pgm,' getstate -cl ',quote($clu),' -d -v')) write $TOP if @DCM_INSTANCES {write '---++ Information about applications and components of each Cluster \ Instance' loop $ins (@DCM_INSTANCES) {# Get the list of components per instance write '---+++ Components of Cluster Instance: ',$ins var @DCM_COMPONENTS = get_dcmctl(concat($pgm,' listComponents -i ',\ quote($ins),' -cl ',quote($clu),\ ' -d -v'),\ 'No component found.%BR%') write $TOP # Get the list of applications per instance component loop $cmp (@DCM_COMPONENTS) {var $cmp = replace($cmp,'^\d*\s*') var ($typ,$nam) = split(':',$cmp,2) if compare('eq',$typ,'oc4j') {write '---++++ List of Applications for Component: ',$nam call get_dcmctl(concat($pgm,' listApplications -cl ',quote($clu),\ ' -i ',quote($ins),' -co ',quote($nam),' -d -v'),\ 'No application found.%BR%') write $TOP } } } } } } toc '2:[[',getFile(),'][rda_report][DCM Cluster]]' =head2 dcm_standalone - Standalone Instances Collects F information for instances that are not part of a cluster. RDA gathers information that includes the components and applications. =cut debug ' Inside IASr2 module, gathering standalone instance configuration' report dcm_standalone write '---+!! 9iAS R2 Standalone Instance Configuration Information' write $TOC write '---+ List of Standalone Instances' var @DCM_INSTANCES = get_dcmctl(concat($pgm,' listInstances -d'),\ 'No instance found.%BR%') if $RUN_DCMCTL {# Collect the complete dcmctl information about each instance loop $ins (@DCM_INSTANCES) {# Get the instance state write '---+ Instance: ',$ins call exec_dcmctl(concat($pgm,' getstate -i ',quote($ins),' -d -v')) var @DCM_COMPONENTS = get_dcmctl(concat($pgm,' listComponents -i ',\ quote($ins),' -d -v'),\ 'No component found.%BR%') write $TOP # Get the list of applications per instance component loop $cmp (@DCM_COMPONENTS) {var $cmp = replace($cmp,'^\d*\s*') var ($typ,$nam) = split(':',$cmp,2) if compare('eq',$typ,'oc4j') {write '---++ List of Applications for Component: ',$nam call get_dcmctl(concat($pgm,' listApplications -i ',quote($ins),\ ' -co ',quote($nam),' -d -v'),\ 'No application found.%BR%') write $TOP } } } } toc '2:[[',getFile(),'][rda_report][Standalone Instances]]' =head2 dcm_dump - dcmctl dump Collects DCM dump information from infrastructure. =cut debug ' Inside IASr2 module, gathering DCM dump information' report dcm_dump write '---+ 9iAS R2 dcmctl dump' call exec_dcmctl(concat($pgm,' dump -d -v')) toc '2:[[',getFile(),'][rda_report][dcmctl dump]]' } debug ' Inside IASr2 module, gathering DCM log files' pretoc '2:DCM Log Files' call search_files($DCM_DCMCTL_LOG,'\.xml$',$DCM_TAIL) call search_files($DCM_EMD_LOG,'\.xml$',$DCM_TAIL) call search_files($DCM_DCMCTL_LOG,'\.dcm',$DCM_TAIL) if ?testDir('d',$DCM_DAEMON_LOG) call search_files($DCM_DAEMON_LOG,'\.xml$',$DCM_TAIL) unpretoc debug ' Inside IASr2 module, gathering DCM configuration files' pretoc '2:DCM Configuration Files' call search_files($DCM_HOME,'\.conf$',0) unpretoc =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 format=raw')) } toc '2:[[',getFile(),'][rda_report][dmstool Dump]]' =head2 HTTP Server Gathers HTTP server information. =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 IASr2 module, getting Apache configuration' call httpServer_getListenerConf() debug ' Inside IASr2 module, getting Apache log files' call httpServer_getListenerLogs() debug ' Inside IASr2 module, getting start scripts' call httpServer_getStartScripts() debug ' Inside IASr2 module, getting mod_plsql configuration' call httpServer_getModplsqlConf() debug ' Inside IASr2 module, getting JServ configuration' call httpServer_getJServConf() debug ' Inside IASr2 module, getting JServ log files' call httpServer_getJServLogs() debug ' Inside IASr2 module, getting JServ Java version' call httpServer_getJServJavaVersions() =head2 LDAP Gathers LDAP information. =cut echo tput('bold'),'Gathering LDAP Information ...',tput('off') pretoc '%SPLIT%' pretoc '1+:LDAP' debug ' Inside IASr2 module, gathering LDAP information' 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 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 IASr2 module, getting OPMN information' report opmnadmin_debug write '---+ opmnadmin & debug' if $NOT_OWNER write $NOT_OWNER_STATEMENT else {var $cmd = concat(catCommand($ORACLE_HOME,'opmn','bin','opmnadmin'),\ ' debug 2>&1') write '---## Using: ',encode($cmd) call writeCommand($cmd) } toc '2:[[',getFile(),'][rda_report][opmnadmin & debug]]' pretoc "2:Configuration Files" call search_files($OPMN_HOME,'\.conf$',0) call search_files($OPMN_HOME,'xml',0) unpretoc pretoc "2:Log Files" call search_files($OPMN_HOME,'log$',$TAIL) call search_files(catDir($OPMN_HOME,'logs'),'.',$TAIL) unpretoc =head2 SYSMAN Gathers SYSMAN information. =cut echo tput('bold'),'Gathering SYSMAN Information ...',tput('off') toc '%SPLIT%' toc '1+:SYSMAN' debug ' Inside IASr2 module, gathering SYSMAN information' call search_files(catDir($SYSMAN_HOME,'log'),'^[^\.]',$TAIL) call search_files(catDir($SYSMAN_HOME,'config'),'properties$',0) call search_files(catDir($SYSMAN_HOME,'admin'),'\.xml$',0) call search_files(catDir($SYSMAN_HOME,'emd'),'\.xml$',0) call search_files(catDir($SYSMAN_HOME,'j2ee'),'\.log$',$TAIL) call search_files(catDir($SYSMAN_HOME,'j2ee'),'xml$',0) =head1 SEE ALSO L, L =begin credits =over 10 =item RDA 4.0: Marc Gueury. =item RDA 4.1: Raul de Diego Garcia, So Sasaki, Yoshimasa Watanabe. =item RDA 4.2: Michael Ferrante. =item RDA 4.6: Takayuki Hamaguchi. =item RDA 4.10: Daniel Mortimer. =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