# MCend.ctl:999:Finalizes the Multi-run Data Collection # $Id: MCend.ctl,v 1.13 2015/08/21 15:33:59 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/RDA/MCend.ctl,v 1.13 2015/08/21 15:33:59 RDA Exp $ # # Change History # 20150821 MSC Improve time consistency. =head1 NAME RDA:MCend - Finalizes the Multi-run Data Collection =head1 DESCRIPTION =cut use Mrc # Initialization var @COMMON_SECTIONS = ('END_files','END_report') var @CONTROL_SECTIONS = ('END_wait') var $VALIDATE = true keep @COMMON_SECTIONS,@CONTROL_SECTIONS,$VALIDATE var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' keep $TOC,$TOP # Define common macros section begin macro link_target {var ($tgt,$key) = @arg var $oid = $tgt->get_oid return concat('[[RDA_END_target.htm#',$oid,'][',\ encode($tgt->get_first($key,$oid)),']]') } =head2 files - Collected Files When the security filter is not enabled, provides an overview of collected files. =cut section END_files if !isFiltered() {debug ' Inside END module, producing the file catalog' report files write '---+!! Collected Files' write $TOC if !writeCatalog() write 'No files collected' } =head2 target - Target Information Produces an overview report of the defined targets for the CFG module. =cut section END_target debug ' Inside END module, producing target overview' report target write '---+!! Target Overview' write $TOC loop $ctl (\ {att => ['T_ORACLE_SID','T_USER','B_SYSDBA'],\ itm => [[D_ORACLE_HOME => 'Oracle home directory']],\ ttl => 'SQL*Plus Query Targets',\ typ => 'SQ'},\ {att => ['T_TYPE','T_SOURCE','T_USER','B_SQLDBA'],\ ttl => 'Data Query Targets',\ typ => 'DQ'},\ {att => ['T_ORACLE_SID','B_PFILE_LOCAL','F_PFILE_LOCATION'],\ itm => [[D_ORACLE_BASE => 'Oracle base directory'],\ [D_ORACLE_HOME => 'Oracle home directory']],\ ttl => 'Database Targets',\ typ => 'DB'},\ {att => ['D_ORACLE_BASE'],\ itm => [[D_ORACLE_HOME => 'Oracle home directory']],\ ttl => 'Oracle Base Targets',\ typ => 'OB'},\ {att => ['D_ORACLE_HOME'],\ ttl => 'Oracle Home Targets',\ typ => 'OH'},\ {att => ['D_MH_HOME'],\ itm => [[D_COMMON_HOME => 'Common Components home directory']],\ ttl => 'Middleware Home Targets',\ typ => 'MH'},\ {att => ['D_COMMON_HOME'],\ ttl => 'Common Components Home Targets',\ typ => 'CH'},\ {att => ['D_WL_HOME'],\ ttl => 'Oracle WebLogic Server Home Targets',\ itm => [[D_MW_HOME => 'Middleware home directory'],\ [D_COMMON_HOME => 'Common Components home directory']],\ typ => 'WH'},\ {att => [[D_DOMAIN_HOME => ['D_DOMAIN_ROOT','T_DOMAIN_NAME']]],\ itm => [[D_MW_HOME => 'Middleware home directory'],\ [D_COMMON_HOME => 'Common Components home directory'],\ [D_WL_HOME => 'Oracle WebLogic Server home directory']],\ ttl => 'Oracle WebLogic Server Domain Home Targets',\ typ => 'DOM'},\ {att => ['D_ORACLE_INSTANCE'],\ itm => [[D_MW_HOME => 'Middleware home directory'],\ [D_COMMON_HOME => 'Common Components home directory'],\ [D_ORACLE_HOME => 'Oracle home directory']],\ ttl => 'Oracle Instance Home Targets',\ typ => 'OI'},\ {ttl => 'System Targets',\ typ => 'SYS'}) {title '---+ ',$ctl->{'ttl'} loop $tgt ($[COL]->get_items($ctl->{'typ'})) {var $oid = $tgt->get_oid write '#',$oid,' ---## ',join(' - ',$oid,$tgt->get_first('T_TITLE')),' ' prefix write '|*Setting*|*Value*|' if exists($ctl->{'att'}) {loop $rec (@{$ctl->{'att'}}) {if ref($rec) {if ?catNative(map(@{$rec->[1]},code($tgt->get_first(last))),'') write '|',$tgt->get_desc($rec->[0]),' |',encode(last),' |' } elsif $tgt->get_text($rec) write '|',$tgt->get_desc($rec),' |',check($rec,\ '^[BGKMNRSVW]_\w+$',join(', ',map(last,code(encode(last)))),\ join('%BR%',map(last,code(encode(last))))),' |' } } if exists($ctl->{'itm'}) {loop $rec (@{$ctl->{'itm'}}) {if $tgt->get_property($rec->[0]) write '|',$rec->[1],' |',check($rec->[0],\ '^[BGKMNRSVW]_\w+$',join(', ',map(last,code(encode(last)))),\ join('%BR%',map(last,code(encode(last))))),' |' } } if hasOutput(true) write $TOP } untitle } # Wait for parallel execution completion section END_wait debug ' Inside END module, waiting for parallel execution completion' call waitModules() =head2 report - Report Settings Produces an overview report of the main current settings and the data collection, as well as some statistics about the SQL statement and operating system command execution for the CFG module. =cut section END_report debug ' Inside END module, producing setting overview' report [1] report write '---+!! Oracle Remote Diagnostic Agent (%ACRONYM:RDA%)' write 'Written by: Oracle Global Customer Support%BR%\ Version: %VERSION%%BR%\ Report created on: ',${RDA.T_GMTIME} write var $ttl = getCollectTitles() if isRendered() {var $hdr = 'System Settings' var @hdr = (concat('[[#%HDR%][',$hdr,']]')) loop $grp (getCollectGroups()) {# Detect a new section if compare('ne',$ttl->{$grp},$hdr) {var $hdr = $ttl->{$grp} call push(@hdr,concat('[[#%HDR%][',$hdr,']]')) } } call push(@hdr,'[[#%HDR%][Data Collection Overview]]',\ '[[#%HDR%][Database Request Overview]]',\ '[[#%HDR%][DBI Request Overview]]',\ '[[#%HDR%][Operating System Command Execution Overview]]',\ '[[#%HDR%][XML Command Execution Overview]]') write '%COL3%',join('%BR%',@hdr),'%ENDCOL%' } else write $TOC # Load the system settings write '---+ ',$hdr = 'System Settings' write '|*Setting*|*Value*|' write '|Machine and version|',uname('a'),'|' write '|Fully qualified host name|',${RDA.T_HOST},'|' run &{check(getOsName(),'aix', 'OS:OSaix',\ 'darwin', 'OS:OSdarwin',\ 'dec_osf', 'OS:OSosf',\ 'dynixptx', 'OS:OSptx',\ 'hpux', 'OS:OShpux',\ 'linux', 'OS:OSlinux',\ 'solaris', 'OS:OSsunos',\ cond(isCygwin(), 'OS:OSwin32',\ isUnix(), 'OS:OSunix',\ isWindows(),'OS:OSwin32',\ isVms(), 'OS:OSvms'))}('END_report') write '|Logged in as|',user(),'|' write '|Last run as|',id(),'|' if isFiltered() write '|%RED%Sensitive information removed?%ENDCOLOR%|%RED%Yes%ENDCOLOR%|' if isUnix() {var $uid= getOwner(getFile('/')) var $own= getOwner(${GRP.BEGIN.D_ORACLE_HOME:''}) if compare('eq',$uid,$own) write '|Executed as Oracle home owner?|Yes|' else write '|Executed as Oracle home owner?|No|' } write '|%ACRONYM:RDA% home directory|',encode(${CFG.D_HOM}),' |' write '|%ACRONYM:RDA% work directory|',encode(${CFG.D_CWD}),' |' if ${SET.K_PRF/TT} write '|Specified profile(s)|',last,' |' # Load the module settings loop $grp (getCollectGroups()) {# Detect a new section if compare('ne',$ttl->{$grp},$hdr) {if hasOutput(true) write $TOP var $hdr = $ttl->{$grp} prefix {write '---+ ',$hdr write '|*Setting*|*Value*|' } } # Treat group members loop $mod (getCollectMembers($grp)) {if $set = ${<'SET',$grp,$mod>/I} {loop $key (@{<'STA',$grp,$mod,'W_RPT'>}) {if $set->is_defined($key) {if match($key,'^I_\w+$') write '|',encode($set->get_desc($key)),' |',\ join(', ',map($set->get_value($key),\ code(link_target(last,'T_TITLE')))),' |' elsif match($key,'^[BGKMNRSVW]_\w+$') write '|',encode($set->get_desc($key)),' |',\ join(', ',map($set->get_text($key),code(encode(last)))),' |' else write '|',encode($set->get_desc($key)),' |',\ join('%BR%',map($set->get_text($key),code(encode(last)))),' |' } } } } } if hasOutput(true) write $TOP # Update the module usage call updateUsage('RDA.END',$[MRC]->is_active) # Add data collection overview prefix {write '---+ Data Collection Overview' write '|*Module*|*Prefix*|*Version*|*Last Run*|*Comment*|' } var (%mrc,%sct) = () loop $mod (getCollectModules()) {var $sta = ${<'STA',$mod>/I} write '|',$mod,'|',$sta->get_first('W_ABR'),' |',\ $sta->get_first('V_RUN'),' |',\ $sta->get_text('G_RUN'),' |',\ $sta->get_first('T_RUN'),' |' if $sta->get_text('G_MRC') var $mrc{$mod} = [last, $sta->get_first('T_MRC_RUN',' ')] if $sta->is_defined('W_SCT') var $sct{$mod} = [nvl(${<'STA',$mod,'W_SCT'>/VT},' '),\ nvl(${<'STA',$mod,'W_SKP'>/VT},' ')] } if hasOutput(true) write $TOP # Add optional collections if !isRendered() {# Add multi-run collection overview prefix {write '---+ Multi-run Data Collection Overview' write '|*Module*|*Last Run*|*Comment*|' } loop $key (keys(%mrc)) write '|',$key,'|',join(' |',@{$mrc{$key}}),' |' if hasOutput(true) write $TOP # Add partial collections prefix {write '---+ Partially Collected Modules' write '|*Module*|*Collected Sections*|*Skipped Sections*|' } loop $key (keys(%sct)) write '|',$key,'|',join(' |',@{$sct{$key}}),' |' if hasOutput(true) {var @{STA.K_PARTIAL:'Partial collection overview'} = keys(%sct) write $TOP } else var ${STA.K_PARTIAL} = undef } # Add module statistics var %ttl = (\ 'DB' ,'---+ SQL Request Overview',\ 'DBI','---+ DBI Request Overview',\ 'OS' ,'---+ Operating System Command Execution Overview',\ 'REM','---+ Remote Command Execution Overview',\ 'XML','---+ XML Command Execution Overview') var %hdr = (\ 'DB' ,'|*Module*| *Requests*| *Errors*| *Time-Out*| *Skipped*|*Comment*|',\ 'DBI','|*Module*| *Requests*| *Errors*| *Time-Out*| *Skipped*|*Comment*|',\ 'OS' ,'|*Module*| *Requests*| *Time-Out*|*Comment*|',\ 'REM','|*Module*| *Requests*| *Errors*| *Time-Out*| *Skipped*|*Comment*|',\ 'XML','|*Module*| *Requests*| *Time-Out*|*Comment*|') loop $typ ('DB','DBI','OS','REM','XML') {var $flg = match($typ,'DB|REM') prefix {write $ttl{$typ} write $hdr{$typ} } var ($tot_err,$tot_out,$tot_req,$tot_skp,$tot,@mod) = (0,0,0,0,0) loop $mod (getCollectModules()) {var $sta = $[COL]->find(join('.','USAGE',$mod)) if ?$sta->get_first(concat('N_REQ_',$typ)) {# Generate the module row var $nb_req = last var $nb_err = $sta->get_first(concat('N_ERR_',$typ),0) var $nb_out = $sta->get_first(concat('N_OUT_',$typ),0) var $nb_skp = $sta->get_first(concat('N_SKP_',$typ),0) var $not = $sta->get_first(concat('T_NOT_',$typ)) if $sta = $sta->find('MRC') {incr $nb_req,$sta->get_first(concat('N_REQ_',$typ),0) incr $nb_err,$sta->get_first(concat('N_ERR_',$typ),0) incr $nb_out,$sta->get_first(concat('N_OUT_',$typ),0) incr $nb_skp,$sta->get_first(concat('N_SKP_',$typ),0) } if $flg write '|',$mod,'| ',$nb_req,'| ',$nb_err,'| ',$nb_out,'| ',$nb_skp,'|',\ encode($not),' |' else write '|',$mod,'| ',$nb_req,'| ',$nb_out,'|',$not,' |' # Define the contributions to the total line incr $tot_err,$nb_err incr $tot_out,$nb_out incr $tot_req,$nb_req incr $tot_skp,$nb_skp # Identify warning areas if and(compare('ne',$mod,'RDA.BEGIN'),or($nb_out,$nb_skp)) {call push(@mod,$mod) incr $tot,$nb_out incr $tot,$nb_skp } } } if $tot_req {if $flg write "|''Total''| ''",\ $tot_req,"''| ''",$tot_err,"''| ''",$tot_out,"''| ''",$tot_skp,"''| |" else write "|''Total''| ''",\ $tot_req,"''| ''",$tot_out,"''| |" } if hasOutput(true) write $TOP elsif isRendered() {write $ttl{$typ} write 'No related modules%BR%' write $TOP } if $tot {var ${STA.N_WARN_${VAR.typ}:"Number of ${VAR.typ} warnings"} = $tot var ${STA.K_WARN_${VAR.typ}:"Modules with ${VAR.typ} warnings"} = [@mod] } else {var ${STA.N_WARN_${VAR.typ}} = undef var ${STA.K_WARN_${VAR.typ}} = undef } } # Add notes write '---+!! Note' write 'This report only contains basic runtime information. \ All data gathered can be found using the links in the index frame.%BR%' write $TOP # Use this report as the default report var ${COL.RENDER.T_REPORT} = getFile() =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L =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