# M999END.def: Finalizes the Multi-run Data Collection # $Id: M999END.def,v 1.8 2012/05/02 22:44:50 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M999END.def,v 1.8 2012/05/02 22:44:50 mschenke Exp $ # # Change History # 20120502 MSC Extend remote command statistics. =head1 NAME S999END - 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 =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' } section END_wait debug ' Inside END module, waiting for parallel execution completion' call waitModules() =cut =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 report write '---+!! Oracle Remote Diagnostic Agent (RDA)' write 'Written by: Oracle Global Customer Support%BR%\ Version: %VERSION%%BR%\ Report created on: ',updateUsage(getLastRun()) write if isRendered() {var $hdr = 'System Settings' var @hdr = (concat('[[#%HDR%][',$hdr,']]')) loop $mod (getModules()) {var $val = getSetting(concat(uc($mod),'_TITLE')) if compare('ne',$val,$hdr) {var $hdr = $val 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 var $hdr = 'System Settings' var $ids = '|*Setting*|*Value*|' write '---+ ',$hdr write $ids # Load the system settings write '|Machine and version|',uname('a'),'|' write '|Fully qualified host name|',${RDA.HOST},'|' run &{check(getOsName(),'aix', 'OSaix',\ 'darwin', 'OSdarwin',\ 'dec_osf', 'OSosf',\ 'dynixptx', 'OSptx',\ 'hpux', 'OShpux',\ 'linux', 'OSlinux',\ 'solaris', 'OSsunos',\ cond(isCygwin(), 'OSwin32',\ isUnix(), 'OSunix',\ isWindows(),'OSwin32',\ isVms(), 'OSvms'))}('END_report',$rpt) 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(getSetting('ORACLE_HOME','')) if compare('eq',$uid,$own) write '|Executed as Oracle home owner?|Yes|' else write '|Executed as Oracle home owner?|No|' } write '|RDA home directory|',encode(${GRP.D_RDA}),' |' write '|RDA work directory|',encode(${GRP.D_CWD}),' |' # Load the module settings loop $mod (getModules()) {var $mod = uc($mod) var $val = getSetting(concat($mod,'_TITLE')) if compare('ne',$val,$hdr) {write $TOP var $hdr = $val write '---+ ',$hdr write $ids } loop $var (split(',',getSetting(concat($mod,'_SETTINGS')))) {var ($val,$dsc) = getDesc($var) next !?$val if compare('eq',$var,'ASIT_INSTANCES') {run ASITlib() var ($hom,$val,%cmp,%ins) = (getSetting('ASIT_INSTANCE_ROOT','')) loop $ins (get_instances($hom,$var)) {var $top = catDir($hom,$ins) var ($nam) = get_components(\%cmp,$top,$ins,'.') var $val = join('%BR%',$val,\ concat($nam,' (location: ',encode($top),')')) } write '|',$dsc,' |',$val,' |' } else write '|',$dsc,'|',replace($val,'\|','%BR%',true),' |' } } write $TOP # Add data collection overview write '---+ Data Collection Overview' write '|*Abbr*|*Module*|*Last Run*|*Comment*|' loop $mod (getModules()) {var $mod = uc($mod) var ($abr) = match($mod,'^S\d{3}(.*)$') if getSetting(concat('LAST_RUN_',$mod)) write '|',$abr,'|',$mod,'|',last,'|',\ getSetting(concat('LAST_INFO_',$mod)),' |' } write $TOP # Add optional collections if !isRendered() {# Add multi-run collection overview prefix {write '---+ Multi-run Data Collection Overview' write '|*Abbr*|*Module*|*Last Run*|*Comment*|' } loop $key (grepSetting('^LAST_MRC_RUN_','n')) {var $mod = substr($key,13) var ($abr) = match($mod,'^S\d{3}(.*)$') write '|',$abr,'|',$mod,'|',getSetting($key),'|',\ getSetting(concat('LAST_MRC_INFO_',$mod)),' |' } if hasOutput(true) write $TOP # Add partial collections var @tbl prefix {write '---+ Partially Collected Modules' write '|*Abbr*|*Module*|*Collected Sections*|*Skipped Sections*|' } loop $mod (getModules()) {next !?getSetting(concat('PARTIAL_COLLECTION_',$mod)) var ($abr,$col,$skp) = (substr($mod,4),split('\/',last)) write '|',$abr,' |',$mod,' |',$col,' |',$skp,' |' call push(@tbl,$abr) } if hasOutput(true) {call setSetting('SECTION_WARNINGS',join(', ',@tbl),\ 'T','Partial collection overview') write $TOP } else call setSetting('SECTION_WARNINGS') } # 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' ,'|*Abbr*|*Module*| *Requests*| *Errors*| *Time-Out*| *Skipped*|\ *Comment*|',\ 'DBI','|*Abbr*|*Module*| *Requests*| *Errors*| *Time-Out*| *Skipped*|\ *Comment*|',\ 'OS' ,'|*Abbr*|*Module*| *Requests*| *Time-Out*|*Comment*|',\ 'REM','|*Abbr*|*Module*| *Requests*| *Errors*| *Time-Out*| *Skipped*|\ *Comment*|',\ 'XML','|*Abbr*|*Module*| *Requests*| *Time-Out*|*Comment*|') loop $key ('DB','DBI','OS','REM','XML') {var $flg = match($key,'DB|REM') prefix {write $ttl{$key} write $hdr{$key} } var ($tot_err,$tot_out,$tot_req,$tot_skp,$tot,@mod) = (0,0,0,0,0) loop $mod (getModules()) {var $mod = uc($mod) var ($abr) = match($mod,'^S\d{3}(.*)$') var $nb_req = getSetting(concat($key,'_STAT_',$mod,'_REQ')) if defined($nb_req) {# Generate the module row var $nb_err = getSetting(concat($key,'_STAT_',$mod,'_ERR'),0) var $nb_out = getSetting(concat($key,'_STAT_',$mod,'_OUT'),0) var $nb_skp = getSetting(concat($key,'_STAT_',$mod,'_SKIP'),0) if $flg write '|',$abr,'|',$mod,'| ',\ $nb_req,'| ',$nb_err,'| ',$nb_out,'| ',$nb_skp,'|',\ getSetting(concat($key,'_STAT_',$mod,'_NOTE')),' |' else write '|',$abr,'|',$mod,'| ',$nb_req,'| ',$nb_out,'|',\ getSetting(concat($key,'_STAT_',$mod,'_NOTE')),' |' # 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,'S000INI'),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{$key} write 'No related modules%BR%' write $TOP } call setSetting(concat($key,'_WARNINGS'),join('|',$tot,@mod),'T',\ concat('Overview of ',$key,' Execution Warnings')) } # 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 =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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