# DCbam.ctl:374:Collects Business Activity Monitoring Information # $Id: DCbam.ctl,v 1.11 2015/07/03 12:04:44 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCbam.ctl,v 1.11 2015/07/03 12:04:44 RDA Exp $ # # Change History # 20150703 MSC Improve the documentation. =head1 NAME OFM:DCbam - Collects Business Activity Monitoring Information =head1 DESCRIPTION This module collects Business Activity Monitoring-related information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing OFM.BAM module ...',tput('off') # Initialization var $BAM_AGE = ${R_AGE/T:365} var $ORACLE_HOME = ${D_ORACLE_HOME/P:''} var @req = ${CUR.O_SETUP}->search('^WREQ_OFM_BAM_DOM') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:Business Activity Monitoring' =head1 ORACLE HOME COLLECTIONS =head2 abbr - Abbreviations Displays the RDA abbreviations defined for the Oracle home collection. =cut debug ' Inside BAM module, collecting defined abbreviations' report abbr prefix {write '---+ Oracle Home Abbreviations' write '|*Abbreviation*|*Location*|' } var %hsh = getSymbols() loop $key (keys(%hsh)) write '|',$key,' |',$hsh{$key},' |' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Abbreviations]]' =head2 product_info - Product Information Gathers the product information if Oracle BAM is installed in a separate Oracle home. =cut if and(${B_DISTINCT_HOME},testDir('d',$ORACLE_HOME)) {# Load the common macros run RDA:INVinfo() debug ' Inside BAM module, processing Product Information (can take time)' report product_info write '---+!! BAM Oracle Home Product Information' write '---## From ',encode($ORACLE_HOME),' ' write $TOC write '---+ Files in BAM Oracle Home' call statDir('an',$ORACLE_HOME) write $TOP call inventory_details(catDir($ORACLE_HOME,'inventory'),${B_INTERIM}) toc '2:[[',getFile(),'][rda_report][Product Information]]' } # Version prior 11g if !or(${B_REQ_IREQ},\ ${B_REQ_WREQ},\ and(testDir('d',catDir($ORACLE_HOME,'bam')),\ testDir('d',catDir($ORACLE_HOME,'soa'))),\ testDir('d',catDir($ORACLE_HOME,'rcu'))) {# Initialization var $BAM_ROOT_DIR = ${D_ROOT:''} var $BAM_LOG_DIR = ${D_LOG:''} var $TAIL = ${DFT.N_TAIL:1000} # Load the common macros run RDA:library() =head2 root_dir - Root Directory Displays the content of the Business Activity Monitoring root directory. =cut debug ' Inside BAM module, processing BAM Root Directory' report root_dir prefix write '---+!! BAM Root Directory Content' call statDir('an',$BAM_ROOT_DIR) if hasOutput(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Root Directory]]' } =head2 Configuration Files Collects the configuration files from the Business Activity Monitoring root directory. =cut debug ' Inside BAM module, getting the configuration files' pretoc '2:Configuration Files' call sort_files(\ 3,$TAIL,grepDir($BAM_ROOT_DIR,'\.config$','ip'),\ grepDir(catDir($BAM_ROOT_DIR,'config'),'\.(properties|xml)$','ip')) unpretoc =head2 Log Files Collects the Business Activity Monitoring log files from the log directory. =cut debug ' Inside BAM module, getting the log files' pretoc '2:Log Files' call sort_files(3,$TAIL,grepDir($BAM_LOG_DIR,'\.log$','ip')) unpretoc } =head2 artifacts - Artifacts Collects Business Activity Monitoring artifacts when there is no need to provide a password interactively. (Available from 10g on Microsoft Windows and from 11g on UNIX) =cut if ?testDir('d',$ORACLE_HOME) {debug ' Inside BAM module, collecting artifacts information (can take time)' # Macro to write the artifacts macro write_artifacts {var (\@tbl,$beg,$end,$tmp,$lvl,$lnk,$ttl,$env) = @arg import $TOC,$TOP keep $TOC,$TOP if @tbl {if $env var $bkp = sourceContext($env) output F,artifacts title '---+!! Business Activity Monitoring Artifacts',$ttl title $TOC loop $rec (@tbl) {var $typ = field('\s',0,$rec) debug ' - Inside BAM module, collecting ',$typ,' artifacts' var $cmd = concat($beg,$rec,$end) call loadCommand($cmd) if getSize($tmp) {write '---+ Export File Content for Type ``',$typ,'``' write '---## Using: ',encode($cmd) call writeFile($tmp) write $TOP } else {prefix {write '---+ Export Command Output for Type ``',$typ,'``' write '---## Using: ',encode($cmd) } call writeLastFile() if hasOutput(true) write $TOP } } if isCreated(true) toc $lvl,':[[',getFile(),'][rda_report][',$lnk,']]' if $env call restoreContext($bkp) } } var ($tmp,@tbl) = (getTemp('TMP')) if ?testFile('f',catFile($ORACLE_HOME,'bam','bin',${AS.BATCH:'icommand'})) {# Prepare the command for BAM 11g var $pgm = lastCommand() var $xml = catFile($ORACLE_HOME,'bam','config','BAMICommandConfig.xml') if and(grepFile($xml,'^[^','f'),\ grepFile($xml,'^[^','f')) {var $beg = concat($pgm,' -cmd export -file ',$tmp,' -type ') var $end = ' -all 1 -systemobjects 1 2>&1' var @tbl = ('distributionlist','ems','eds','folder',\ 'dataobject -contents 0','report','rule','securityfilters') pretoc '2:Artifacts' loop $req (@req) {var $dom = $req->get_first('I_DOMAIN') var ($bas,$env) = ($dom->get_first('T_DOMAIN_NAME'),testFile('f',\ catFile($dom->get_first('D_DOMAIN_HOME'),'bin',${AS.CMD:'setDomainEnv'}))) debug ' - Inside BAM module, analyzing ',$bas,' domain' call write_artifacts(\@tbl,$beg,$end,$tmp,3,concat("'",$bas,"' Domain"),\ concat(' (',$bas,')'),$env) } unpretoc } else {report artifacts write '---+ Business Activity Monitoring Artifacts' write ' * Security credentials not found in ',encode($xml) write ' * and/or BAM server specified in ',encode($xml),' is not running' write ' * Skipping BAM Artifacts Collection' toc '2:[[',getFile(),'][rda_report][Artifacts]]' } } elsif ?testFile('f',catFile($ORACLE_HOME,'bam',${AS.EXE:'icommand'})) {# Prepare the command for BAM 10g var $beg = concat(lastCommand(),' cmd=export file=',$tmp,' type=') var $end = ' all=1 systemobjects=1 2>&1' var @tbl = ('distributionlist','ems','emstype','eds','edstype','folder',\ 'dataobject contents=0','report','rule','user','role','plan',\ 'securityfilters') call write_artifacts(\@tbl,$beg,$end,$tmp,2,'Artifacts') } call unlinkTemp('TMP') } =head2 eventx - Events Extracts the details of all the events related to Business Activity Monitoring services from the application event log using the F command. (Only available for Windows Vista, Windows Server 2008, and Windows 7) =cut if or(isWindows(),isCygwin()) {debug ' Inside BAM module, obtaining the BAM events' var $osv = getRegValue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion',\ 'CurrentVersion') if compare('ge',$osv,'6') {if ?findCommand('wevtutil') {var $evt = last var $msc = expr('*',$BAM_AGE,86400000) var $tmp = getTemp('dat') call command(concat($evt,' qe Application ',\ '"/q:*[System[TimeCreated[timediff(@SystemTime) <= ',$msc,\ ']]]" /f:xml >',$tmp)) code write_data {loop $lin (parseBuffer()) write $lin } report eventx write '---+!! Business Activity Monitoring Events' prefix call beginBlock(true) if createBuffer('EVT','R',$tmp) {call parseReset() call parseBegin('TOP',\ '^','Event') call parseEnd('Event','$') call parseInfo('Event','buf',-1) call parseInfo('Event','end',&write_data) call parseInfo('Event','llp',false) call parse('EVT') call deleteBuffer('EVT') } if hasOutput(true) call endBlock(['C','wevtutil qe Application | grep -i BAM']) else write '**No Business Activity Monitoring events found.**%BR%' toc '2:[[',getFile(),'][rda_report][Events]]' call unlinkTemp('dat') } } =head2 events - Events Extracts the details of all the events related to Business Activity Monitoring services from the application event log. (Only available for Windows NT, Windows 2000, Windows XP, and Windows 2003) =cut else {# Get the event file var $fil = replaceEnv(getRegValue(\ 'HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application',\ 'File')) # If the file is not readable try to copy to a temporary file var $flg = false if ?testFile('r',$fil) var $evt = $fil else {if ?testFile('f',$cmd = getGroupFile('D_CWD','cmd.exe')) {var $cmd = quote($cmd) if grepCommand(concat($cmd,' /c if exist mode.com echo 32to64'),'^32to64') {var $flg = true var $evt = getTemp('evt','.evt') call system(concat($cmd,' /c copy ',\ quote($fil),' ',\ quote($evt),' >NUL 2>NUL')) } } } # Extract the BAM events if ?testFile('r',$evt) {report events write '---+!! Business Activity Monitoring Events' if !writeEvents($evt,'\b[Bb][Aa][Mm]\b',$BAM_AGE) write '**No Business Activity Monitoring events found.**%BR%' toc '2:[[',getFile(),'][rda_report][Events]]' } if $flg call unlinkTemp('evt') } } =head1 ORACLE HOME INFORMATION =head2 Manifest Information Gathers the Oracle home manifest information. =cut if or(${B_REQ_IREQ},\ ${B_REQ_WREQ},\ and(testDir('d',catDir($ORACLE_HOME,'bam')),\ testDir('d',catDir($ORACLE_HOME,'soa'))),\ testDir('d',catDir($ORACLE_HOME,'rcu'))) {# Load the common macros run OFM:WLSlib() debug ' Inside BAM module, getting Oracle home manifest information \ (can take time)' pretoc '2:Manifest Information' call dsp_manifest(3,$ORACLE_HOME) unpretoc } =head1 COMMON HOME INFORMATION Includes the reports generated by the L module about the common home. =cut if ${B_REQ_IREQ} {toc '%PUSH("%SPLIT%")%' toc '%PUSH("1+:Common Product Home")%' toc '%INCLUDE("OFM_IREQ_OFM_BAM_CH_TF.toc")%' toc '%POP2%' } =head1 ORACLE WEBLOGIC SERVER DOMAIN COLLECTIONS It includes all reports produced by the L module for the specified Oracle WebLogic Server domains. =cut if ${B_REQ_WREQ} {# Analyze the domain requests var %tbl = () loop $req (@req) {var $dom = $req->get_first('I_DOMAIN') if ?$dom->get_first('I_WL_HOME') var $tbl{last->get_oid,$req->get_oid} = $dom->get_first('T_DOMAIN_NAME') else var $tbl{'WH',$req->get_oid} = $dom->get_first('T_DOMAIN_NAME') } # Include the table of content files produced by WREQ loop $oid (keys(%tbl)) {if $orp = compare('eq',$oid,'WH') toc '%PUSH("0: * Orphan Domains")%' toc '%PUSH("%SPLIT%")%' toc '%PUSH("1+:Oracle WebLogic Server Overview")%' toc '%INCLUDE("OFM_WREQ_OFM_BAM_',$oid,'_TF.toc")%' toc '%POP2%' loop $tid (keys($tbl = $tbl{$oid})) {toc '%PUSH("%SPLIT%")%' toc '%PUSH("1+:',"'",$tbl->{$tid},"'",' Domain")%' toc '%INCLUDE("OFM_',$tid,'_TF.toc")%' toc '%POP2%' } if $orp toc '%POP%' } } unpretoc =head1 SEE ALSO L, L, L, L, L =begin credits =over 10 =item RDA 4.15: Marcus Lachmanez. =item RDA 4.22: Antony Reynolds. =item RDA 4.24: Greg Cook, Andrew Salt. =item RDA 4.25: Pravin Pawar, Antony Reynolds, Maria Salzberger. =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