# S545EPM.def: Collects Enterprise Performance Management System Information # $Id: S545EPM.def,v 1.23 2012/08/29 17:02:50 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/S545EPM.def,v 1.23 2012/08/29 17:02:50 mschenke Exp $ # # Change History # 20120829 KRA Add EPM events collection. =head1 NAME S545EPM - Collects Enterprise Performance Management Information System =head1 DESCRIPTION This module collects common information for Oracle enterprise performance management applications. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing EPM module ...',tput('off') # Initialization var $AGE = ${EPM_LOG_AGE:15} var $EPM_HOME = ${EPM_HOME:${ENV.EPM_ORACLE_HOME:${ENV.HYPERION_HOME:''}}} var $EPM_INSTANCES = ${EPM_INSTANCES} var $MOD = cond(isWindows(),'f',\ isCygwin(), 'f',\ 'fx') var $REG = ${AS.BAT:'epmsys_registry'} var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' if ?$EPM_INSTANCES {pretoc '0: * Enterprise Performance Management (Hyperion)' pretoc '1+:Product Home' } else pretoc '1:Enterprise Performance Management (Hyperion)' # Load the common macros run EPMlib() run INSTinfo() # Password file on version 11.1.2.2 and later var $EPM_VERSION = get_epm_version($EPM_HOME) if compare('valid',$EPM_VERSION,'11.1.2.2') {var $epm = createTemp('EPMPWD','.tmp',false) if getSetting('SQL_PASSWORD_EPM_REGISTRY') var ($pwd) = unpack('u',last) else var $pwd = askPassword('Enter Shared Services database password:') call writeTemp('EPMPWD',$pwd) call closeTemp('EPMPWD') } =head1 PRODUCT HOME REPORTS =head2 product_info - Product Information Gathers the product information when the product home has an F directory. =cut if testDir('d',catDir($EPM_HOME,'inventory')) {debug ' Inside EPM module, processing Product Information (can take time)' report product_info write '---+!! EPM Oracle Home Product Information' write $TOC call inventory_details(catDir($EPM_HOME,'inventory'),true) toc '2:[[',getFile(),'][rda_report][Product Information]]' } =head2 registry - Windows Registry Information Collects Windows registry information. =cut if or(isWindows(),isCygwin()) {debug ' Inside EPM module, gathering Windows registry information' report registry title '---+!! Windows Registry Information' title $TOC title '---+ Enterprise Performance Management Product Information' var %key = () if hasRegOption() {if writeRegistry64('HKLM\SOFTWARE\Hyperion Solutions') write $TOP if writeRegistry32('HKLM\SOFTWARE\Hyperion Solutions') write $TOP if writeRegistry64('HKLM\SOFTWARE\Hyperion Java Services\Hyperion Solutions') write $TOP if writeRegistry32('HKLM\SOFTWARE\Hyperion Java Services\Hyperion Solutions') write $TOP if writeRegistry64('HKLM\SOFTWARE\ODBC\ODBC.INI') write $TOP if writeRegistry32('HKLM\SOFTWARE\ODBC\ODBC.INI') write $TOP if writeRegistry64('HKLM\SOFTWARE\ODBC\ODBCINST.INI') write $TOP if writeRegistry32('HKLM\SOFTWARE\ODBC\ODBCINST.INI') write $TOP loop $key (grepReg64Value('HKLM\SOFTWARE\ORACLE','ORACLE_HOME_NAME'),\ grepReg32Value('HKLM\SOFTWARE\ORACLE','ORACLE_HOME_NAME')) var $key{field('\\',-1,$key)} = $key loop $key (keys(%key)) {if writeRegistry64(concat('HKLM\SOFTWARE\ORACLE\',$key)) write $TOP if writeRegistry32(concat('HKLM\SOFTWARE\ORACLE\',$key)) write $TOP } } else {if writeRegistry('HKLM\SOFTWARE\Hyperion Java Services\Hyperion Solutions') write $TOP if writeRegistry(\ 'HKLM\SOFTWARE\Wow6432Node\Hyperion Java Services\Hyperion Solutions') write $TOP if writeRegistry('HKLM\SOFTWARE\Hyperion Solutions') write $TOP if writeRegistry('HKLM\SOFTWARE\Wow6432Node\Hyperion Solutions') write $TOP if writeRegistry('HKLM\SOFTWARE\ODBC\ODBC.INI') write $TOP if writeRegistry('HKLM\SOFTWARE\Wow6432Node\ODBC\ODBC.INI') write $TOP if writeRegistry('HKLM\SOFTWARE\ODBC\ODBCINST.INI') write $TOP if writeRegistry('HKLM\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI') write $TOP loop $key (\ grepRegValue('HKLM\SOFTWARE\ORACLE','ORACLE_HOME_NAME'),\ grepRegValue('HKLM\SOFTWARE\Wow6432Node\ORACLE','ORACLE_HOME_NAME')) var $key{field('\\',-1,$key)} = $key loop $key (keys(%key)) {if writeRegistry(concat('HKLM\SOFTWARE\ORACLE\',$key)) write $TOP if writeRegistry(concat('HKLM\SOFTWARE\Wow6432Node\ORACLE\',$key)) write $TOP } } if writeRegistry(\ 'HKLM\SYSTEM\CurrentControlSet\Services\HyS9FoundationServices') write $TOP if writeRegistry('HKLM\SYSTEM\CurrentControlSet\Services\HyS9RaFramework') write $TOP if writeRegistry('HKLM\SYSTEM\CurrentControlSet\Services\HyS9RaFrameworkAgent') write $TOP if writeRegistry('HKLM\SOFTWARE\Brio Software') write $TOP var %key = () loop $key (grepRegValue('HKLM\SYSTEM\CurrentControlSet\Services','ImagePath')) {var $sub = field('\\',-1,$key) next !match($sub,'^Oracle') var $key{$sub} = $key } loop $key (keys(%key)) {if writeRegistry(concat('HKLM\SYSTEM\CurrentControlSet\Services\',$key)) write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Windows Registry Information]]' =head2 eventx - EPM Events Extracts Enterprise Performance Management System events from the application event log using the F command. (Only available for Windows Vista, Windows Server 2008, and Windows 7) =cut debug ' Inside EPM module, gathering event log information' var $osv = getRegValue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion',\ 'CurrentVersion') if compare('valid',$osv,'6') {if findCommand('wevtutil') {var $evt = last var $msc = expr('*',$AGE,86400000) var $tmp = getTemp('dat') call command(concat($evt,' qe Application ',\ '"/q:*[System[TimeCreated[timediff(@SystemTime) <= ',$msc,\ ']]]" /f:xml > ',quote($tmp,'x'))) code write_data {loop $lin (parseBuffer()) write replace(replace($lin,'<','<',true),'>','>',true) } report eventx write '---+!! Enterprise Performance Management System 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 \ ASP.NET|\ HyperionService|\ HyS9FoundationServices|\ HyS9RaFramework|\ HyS9RaFrameworkAgent']) else write '**No Enterprise Performance Management System events found.**%BR%' toc '2:[[',getFile(),'][rda_report][EPM Events]]' call unlinkTemp('dat') } } =head2 events - EPM Events Extracts Enterprise Performance Management System events 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,'x') 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,'x'),' ',\ quote($evt,'x'),' >NUL 2>NUL')) } } } # Extract the Enterprise Performance Management System events if testFile('r',$evt) {report events write '---+ Application Events' if !writeEvents($evt,'(ASP\.NET\s\d+\.\d+\.\d{5}\.\d+|\ HyperionService|\ HyS9FoundationServices|\ HyS9RaFramework|\ HyS9RaFrameworkAgent)',$AGE) write '**No Enterprise Performance Management System events found.**%BR%' toc '2:[[',getFile(),'][rda_report][EPM Events]]' } if $flg call unlinkTemp('evt') } } =head2 Executable, Library, and Java Archive Versions For Windows, collects the executable, library, and Java archive versions from the F<$EPM_ORACLE_HOME/common> or F<$HYPERION_HOME/common> directory structure. When F is available, it extracts the manifest from Java archives. =cut debug ' Inside EPM module, gathering file versions' pretoc '2:Executable, Library, and Java Archive Versions' macro dsp_versions {var ($rpt,$lvl,$dir,$opt,$dpt) = @arg import $EPM_HOME,$TOC,$TOP,$UNZIP keep $EPM_HOME,$TOC,$TOP,$UNZIP call $[OUT]->add_report('C',$rpt,0) prefix {write '---+!! Version Information from ',encode($dir),' Directory' write $TOC } loop $fil (grepDir(catDir($EPM_HOME,$dir),\ '\.(a|dll|exe|jar|asp|ass|css|cs|js|so|xml|xslt)$',$opt,$dpt)) {write '---+ Version Information from ',encode(basename($fil)) call statFile('p',$fil) write '%BR%' if or(isWindows(),isCygwin()) {var $inf = getVersionInfo($fil) loop $key (keys($inf)) write '|*',$key,' *|',replace($inf->{$key},'\012','%BR%',true),' |' } write $TOP if and(match($fil,'\.jar$',true),$UNZIP) {prefix write '---++ Manifest Information' var $cmd = concat($UNZIP,' -p ',$fil,' META-INF/MANIFEST.MF') call writeCommand($cmd) if hasOutput(true) write $TOP } } if isCreated(true) toc $lvl,':[[',getFile(),'][rda_report][In ',encode($dir),']]' } var $UNZIP = findCommand('unzip') pretoc '3:$EPM_HOME/common' var $cnt = 0 call dsp_versions('ver_com',4,'common','dip') loop $sub (grepDir(catDir($EPM_HOME,'common'),'^\.+$','nv')) {if testDir('d',catDir($EPM_HOME,'common',$sub)) call dsp_versions(concat('ver_com',incr($cnt)),4,\ catDir('common',$sub),'dir') } unpretoc 2 =head2 epmsys_registry - EPM Registry Exports the enterprise performance management system registry using F<$HYPERION_HOME/common/config/9.5.0.0/epmsys_registry.sh> or F<$HYPERION_HOME/common/config/9.5.0.0/epmsys_registry.bat> (on versions earlier than 11.1.2). =cut macro write_epm_reg {var ($fil) = @arg import $TOC,$TOP keep $TOC,$TOP var $top = htmlLoadFile($fil,\ htmlFilter(htmlDisable(htmlParser(),'DR'),'A','B','DIV','TD','TH')) report epmsys_registry title '---+!! EPM Registry' title $TOC var $flg = false loop $blk (htmlContent($top,'T')) {var $tag = htmlName($blk) if compare('eq',$tag,'div') {var ($itm,@tbl,@val) = htmlContent($blk) var $tag = htmlName($itm) if compare('eq',$tag,'a') {var ($ttl,$typ) = htmlContent($itm) if isCreated() write $TOP write '#EPM',replace(htmlValue($itm,'name'),'\W','_',true) write '---+ ',encode(trim(htmlText($ttl))),' ',\ encode(trim(htmlText($typ),"\240")) } elsif compare('eq',$tag,'b') {var $key = trim(htmlText($itm)) loop $itm (@tbl) {if match(htmlValue($itm,'href'),'^\#(.*)') call push(@val,concat('[[#EPM',replace(last,'\W','_',true),'][',\ encode(trim(htmlText($itm))),']]')) elsif and(length($val = trim(htmlText($itm),"\240")),\ compare('ne',$val,'None')) call push(@val,replace(encode($val)," ","%BR%",true)) } if @val {if delete($flg) write '| ||' write '|*',encode($key),'* |',join('%BR%',@val),' |' } } } elsif compare('eq',$tag,'table') {var ($hdr,%tbl) = ('|*Name* |*Value* |') loop $rec (htmlContent($blk,'T')) {var ($key,$val) = htmlContent($rec,'T') var $key = trim(htmlText($key)) var $val = trim(htmlText($val)) if compare('eq',htmlValue($rec,'class'),'header') var $hdr = concat('|*',$key,'* |*',encode($val),'* |') else var $tbl{$key} = check($key,\ 'Password',cond(length($val),'%R:PASSWORD%',''),\ 'Template',replace(encode(replace($val,';',";\012",true)),\ '\012','%BR%',true),\ encode($val)) } prefix write $hdr loop $key (keys(%tbl)) write '|',encode($key),' |',$tbl{$key},' |' var $flg = hasOutput(true) } } if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][EPM Registry]]' } } if !?$EPM_INSTANCES {if testFile($MOD,catFile(catDir($EPM_HOME,'common','config','9.5.0.0'),$REG)) {var $dir = lastDir() var $cmd = lastCommand() debug ' Inside EPM module, getting the EPM registry' if testFile($MOD,catFile($dir,${AS.BAT:'setEnv'})) call source(getNativePath(lastFile()),true) if grepCommand(concat($cmd,' view SYSTEM9'),'FOUNDATION_SERVICES_PRODUCT','f') {if grepCommand($cmd,'^File location .*','f') {var ($loc) = match(last,'^File location (.*)') if testFile('fr',catFile($loc,'registry.html')) call write_epm_reg(lastFile()) } elsif testFile('fr',catFile($dir,'registry.html')) call write_epm_reg(lastFile()) } } } =head1 DEPLOYMENT REPORTS Available on version 11.1.2 and later. =head2 EPM Registry Exports the enterprise performance management system registry using F<$INSTANCE_HOME/bin/epmsys_registry.sh> or F<$INSTANCE_HOME/bin/epmsys_registry.bat>. =cut else {loop $key (grepSetting('EPM_OI\d+_REQ_INSTANCE')) {var ($num) = match($key,'^EPM_OI(\d+)_REQ_INSTANCE') var $ins = getSetting($key) var $bas = basename($ins) call setAbbr(concat('EPM_i',$num)) toc '%SPLIT%' toc "1+:'",$bas,"' Deployment" if testFile($MOD,catFile(catDir($ins,'bin'),$REG)) {var ($cmd,$tmp) = (lastCommand(),'EPMSYS_REG') if ?create_epm_script($tmp,lastFile(),$epm) var $cmd = quote(last,'x') else var $tmp = undef debug ' Inside EPM module, getting the EPM registry for ',$bas if testFile($MOD,catFile(lastDir(),${AS.BAT:'setEnv'})) call source(getNativePath(lastFile()),true) if grepCommand(concat($cmd,' view SYSTEM9'),'FOUNDATION_SERVICES_PRODUCT',\ 'f') {if grepCommand($cmd,'^File location .*','f') var ($loc) = match(last,'^File location (.*)') elsif grepCommand($cmd,'^The report.*','f') var ($loc) = match(last,'^The report.*?generated at\s+(.*?)\.\s+Please') else var $loc = '' if testFile('fr',catFile($loc,'registry.html')) call write_epm_reg(lastFile()) } elsif or(testFile('fr',catFile($ins,'diagnostics','logs','reports',\ 'registry.html')),\ testFile('fr',catFile($ins,'diagnostics','reports',\ 'registry.html'))) call write_epm_reg(lastFile()) # Unlink the temporary file if ?$tmp call unlinkTemp($tmp) } =head2 Common Home Information Includes the reports generated by the IREQ module about the common home. =cut toc '%PUSH("%SPLIT%")%' toc '%PUSH("1++:Common Product Home")%' toc '%INCLUDE("',${CUR.GROUP},'_IREQ_EPM_CH',$num,'.toc")%' toc '%POP2%' =head2 Web Tier Information Includes the reports generated by the IREQ module about the Oracle instance and its associated Oracle home. =cut toc '%PUSH("%SPLIT%")%' toc '%PUSH("0: * Oracle WebTier Instance")%' toc '%PUSH("1+++:Associated Oracle Home")%' toc '%INCLUDE("',${CUR.GROUP},'_IREQ_EPM_OH',$num,'.toc",2)%' toc '%POP%' toc '%PUSH("%SPLIT%")%' toc '%PUSH("1+++:Instance Home")%' toc '%INCLUDE("',${CUR.GROUP},'_IREQ_EPM_OI',$num,'.toc",1)%' toc '%POP4%' =head2 Oracle WebLogic Server Information Includes the Oracle WebLogic reports generated by the WREQ module for the associated Oracle WebLogic Server domain. =cut if getSetting('EPM_PRIMARY') {if ?getSetting(concat('EPM_DOM',$num,'_REQ_DOMAIN')) {var $dom = basename(last) toc '%PUSH("%SPLIT%")%' toc '%PUSH("1++:Oracle WebLogic Server Overview")%' toc '%INCLUDE("',${CUR.GROUP},'_WREQ_EPM_TOP',$num,'.toc",1)%' toc '%POP2%' toc '%PUSH("%SPLIT%")%' toc '%PUSH("1++:',"'",$dom,"'",' Domain")%' toc '%INCLUDE("',${CUR.GROUP},'_WREQ_EPM_DOM',$num,'.toc",1)%' toc '%POP2%' } } } } # Unlink the temporary password file if ?$epm call unlinkTemp('EPMPWD') unpretoc 2 =head1 SEE ALSO L, L, L, L =begin credits =over 10 =item RDA 4.22: Venkat Madipati. =item RDA 4.24: Venkat Madipati. =item RDA 4.29: Maurice Bauhahn. =back =end credits =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