# DCccr.ctl:910:Collects OCM Diagnostic Information # $Id: DCccr.ctl,v 1.4 2013/10/30 07:18:46 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/RDA/DCccr.ctl,v 1.4 2013/10/30 07:18:46 RDA Exp $ # # Change History # 20130422 MSC Improve the validation. =head1 NAME RDA:DCccr - Collects OCM Diagnostic Information =head1 DESCRIPTION This module collects diagnostic information from Oracle Configuration Manager (OCM) installations detected in Oracle homes provided at RDA setup. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing RDA.CCR module ...',tput('off') # Initialization var $TAIL = ${DFT.N_TAIL:1000} var $UNZIP = findCommand('unzip') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:OCM' # Load the common macros run RDA:library() =head2 env - Environment Variables Collects important environment variables. =cut debug ' Inside CCR module, collecting important environment variables' report env prefix {write '---+ Important Environment Variables' write '|*Variable*|*Value*|' } loop $key (grepEnv('^CCR_')) write '|',$key,' |',getEnv($key),' |' if ?${ENV.ORACLE_CONFIG_HOME} write '|ORACLE_CONFIG_HOME |',last,' |' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Environment Variables]]' # Define the OCM collection macros macro collect_data {var ($nam,$top,$ttl) = @arg import $TAIL,$TOC,$TOP keep $TAIL,$TOC,$TOP if ?testDir('d',$top) {# Define the new context pretoc '2:OCM in ',$ttl,' ' var $old = setPrefix($nam) =head1 FOR EACH SELECTED OCM INSTALLATION =head2 status - OCM Status Collects the OCM status. =cut debug ' Inside CCR module, requesting the OCM status (',$nam,')' report status prefix {write 'OCM Status' write 'Using: emCCR status' } var $cmd = ${AS.BATCH:'emCCR'} call writeCommand(concat(catCommand($top,'bin',$cmd),' status 2>&1')) if isCreated(true) toc '3:[[',getFile(),'][rda_report][OCM Status]]' =head2 inventory - OCM Inventory Lists the Jar files present in the inventory directories and extracts their manifest when F is available. =cut macro dsp_inv {var ($dir,$ttl) = @arg import $TOP,$UNZIP keep $TOP,$UNZIP if @tbl = grepDir($dir,'\.jar$','inp') {write '---+ ',$ttl,' ' write '---## From ',$dir call statFile('b',@tbl) write $TOP if $UNZIP {loop $jar (@tbl) {prefix write '---++ Manifest from ',basename($jar) call writeCommand(concat($UNZIP,' -p ',quote($jar),\ ' META-INF/MANIFEST.MF')) if hasOutput(true) write $TOP } } } } debug ' Inside CCR module, checking the OCM inventory (',$nam,')' report inventory prefix {write '---+!! OCM Inventory' write $TOC } call dsp_inv(catDir($top,'inventory'),'Installed Components') call dsp_inv(catDir($top,'inventory','pending'),'Pending Components') if isCreated(true) toc '3:[[',getFile(),'][rda_report][OCM Inventory]]' =head2 hosts - Configured Hosts Lists the configured hosts. =cut debug ' Inside CCR module, listing configured hosts (',$nam,')' var @tbl loop $pth (grepDir(catDir($top,'hosts'),'^\.+$','npv')) {if ?testDir('d',$pth) call push(@tbl,$pth) } if @tbl {report hosts prefix {write '---+ Configured Hosts' write '---## From ',lastDir() } call statFile('b',@tbl) if isCreated(true) toc '3:[[',getFile(),'][rda_report][Configured Hosts]]' } =head2 Configuration Files Collects the configuration files. =cut debug ' Inside CCR module, collecting configuration files (',$nam,')' var $dir1 = catDir($top,'hosts',${RDA.T_HOST}) var $dir2 = catDir($top,'hosts',${RDA.T_NODE}) pretoc '3:Configuration Files' call sort_files(4,$TAIL,\ catFile($top,'config','ccr.properties'),\ catFile($top,'config','collector.properties'),\ catFile($top,'config','sched.properties'),\ catFile($top,'config','default','ccr.properties'),\ catFile($top,'config','default','collector.properties'),\ catFile($top,'config','default','sched.properties'),\ grepDir(catDir($dir1,'config'),'emCCRenv'),\ grepDir(catDir($dir1,'config'),'\.properties$','nr',2),\ grepDir(catDir($dir2,'config'),'emCCRenv'),\ grepDir(catDir($dir2,'config'),'\.properties$','nr',2)) unpretoc =head2 Review Files Collects the review files. =cut debug ' Inside CCR module, collecting review files (',$nam,')' pretoc '3:Review Files' call sort_files(4,$TAIL,\ grepDir(catDir($dir1,'state','review'),'\.xml$','np'),\ grepDir(catDir($dir2,'state','review'),'\.xml$','np')) unpretoc =head2 db - Database Collections Gets details about the database collection files. =cut debug ' Inside CCR module, listing database collection files (',$nam,')' if @tbl = grepDir(catDir($top,'state'),'\.ll\b','inp') {report db prefix {write '---+ Database Collections' write '---## From ',encode(lastDir()) } call statFile('b',@tbl) if isCreated(true) toc '3:[[',getFile(),'][rda_report][Database Collections]]' } =head2 Log Files Collects the log files. =cut debug ' Inside CCR module, collecting log files (',$nam,')' pretoc '3:Log Files' call sort_files(4,$TAIL,\ grepDir(catDir($dir1,'log'),'^\.','npv'),\ grepDir(catDir($dir2,'log'),'^\.','npv')) unpretoc # Restore the abbreviation call setPrefix($old) } } macro collect_config {var ($nam,$dir) = @arg pretoc '2:Instance Home ',$dir debug ' Inside CCR module, collecting configuration files (instance ',$nam,')' pretoc '3:Configuration Files' call sort_files(4,$TAIL,\ catFile($dir,'ccr','config','emCCRenv'),\ catFile($dir,'ccr','config','ccr.properties'),\ catFile($dir,'ccr','config','collector.properties'),\ catFile($dir,'ccr','config','sched.properties'),\ catFile($dir,'ccr','config','default','ccr.properties'),\ catFile($dir,'ccr','config','default','collector.properties'),\ catFile($dir,'ccr','config','default','sched.properties')) unpretoc debug ' Inside CCR module, collecting review files (instance ',$nam,')' pretoc '3:Review Files' call sort_files(4,$TAIL,\ grepDir(catDir($dir,'ccr','state','review'),'\.xml$','np')) unpretoc debug ' Inside CCR module, collecting log files (instance ',$nam,')' pretoc '3:Log Files' call sort_files(4,$TAIL,\ grepDir(catDir($dir,'ccr','log'),'^\.','npv')) unpretoc 2 } # Perform the collections loop $nam (@{W_TARGETS}) {var ($typ) = match($nam,'^([A-Z]+)_') call addTarget($itm = findItem($typ,'.',$nam)) if compare('eq',$nam,'OI') call collect_config($nam,$itm->get_first('D_ORACLE_INSTANCE')) else call collect_data($nam,\ $itm->get_first('D_CCR_HOME'),\ $itm->get_first('T_TITLE')) } =head1 SEE ALSO L, L =begin credits =over 10 =item RDA 4.18: Eliane Papillon Le Noc. =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