# DCwreq.ctl:301:Handles Collection Requests from Oracle WebLogic Server Modules # $Id: DCwreq.ctl,v 1.74 2015/10/30 10:18:46 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCwreq.ctl,v 1.74 2015/10/30 10:18:46 RDA Exp $ # # Change History # 20151029 KRA Extend the filtering capabilities. =head1 NAME OFM:DCwreq - Handles Collection Requests from Oracle WebLogic Server Modules =head1 DESCRIPTION This module collects information for Oracle WebLogic Server domain homes. =cut use Xml echo tput('bold'),'Processing OFM.WREQ module ...',tput('off') # Initialization var $BSU_FACTOR = ${R_BSU_FACTOR:1} var $DFT_TIMEOUT = ${DFT.N_TIMEOUT:30} var $DIAG_IMAGES = ${B_DIAG_IMAGES:true} var $INCIDENT_FILES = ${N_INCIDENT_FILES:5} var $LOG_AGE = ${R_LOG_AGE/T:15} var $LOG_FILES = ${B_LOG_FILES:true} var $MAX = ${N_INCIDENTS:10} var $ONLY_README = ${B_ONLY_README:false} var $ROTATED_LOGS = ${N_ROTATED_LOGS:2} var $SRVOUT_SIZE = int(expr('*',${R_SRVOUT_SIZE:1},-1048576)) var $TAIL = ${DFT.N_TAIL:1000} var $THREAD = ${B_THREAD_DUMP:true} var $THREAD_DUMP = ${N_THREAD_DUMP:10} var $THREAD_DUMP_INT = ${N_THREAD_DUMP_INTERVAL:5000} var $TIMEOUT = ${N_IMAGE_TIMEOUT:90} if and(${B_CUSTOM_SCRIPTS},not(${B_CUSTOM_SCRIPTS_DOM_BIN})) var $CUSTOM_SCRIPTS_DIR = ${D_CUSTOM_SCRIPTS:''} var $RPT_DIRECTORY = getGroupDir('D_CWD',${OUT.C}) var $CHK = cond(isWindows(),'f',isCygwin(),'f','fx') var $FCP = getCodePage() var $PRE = setPrefix() var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var $WL_HOME = '' var $WLS_TOP = '' var $PLUGIN = {} var %DOMAINS var %DUP var %ENV var %FCP var %FLT var %LOG var %LOGIN var %STA var %TOPOLOGY var %URL # Determine the command path if ${OS.aix} {if ?findCommand('procmap') var $PMAP = last if ?findCommand('procstack') var $PSTACK = last } elsif ${OS.hpux} {if ?findCommand('pmap') var $PMAP = last if ?findCommand('pstack') # Itanium systems only var $PSTACK = last } elsif ${OS.linux} {if ?findCommand('pmap') {var $PMAP = last if grepCommand(concat($PMAP,' 2>&1'),'^\s*-x,?\s+','f') var $PMAP = concat($PMAP,' -x') } if ?findCommand('pstack') var $PSTACK = last } elsif ${OS.solaris} {if ?findCommand('pmap') var $PMAP = concat(last,' -x') if ?findCommand('pstack') var $PSTACK = last } # Get the ps command format var $PS_EF 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:OSunix',\ isUnix(), 'OS:OSunix'))}('PS') # Reference files related to Oracle WebCenter for configuration comparison var $WCP{'adf-config.xml'} = catFile(${CUR.D_DIRECTORY},'WCadf.txt') var $WCP{'web.xml'} = catFile(${CUR.D_DIRECTORY},'WCweb.txt') var $WCP{'weblogic-application.xml'} = catFile(${CUR.D_DIRECTORY},'WCapp.txt') var $WCP{'weblogic.xml'} = catFile(${CUR.D_DIRECTORY},'WCwl.txt') # Load the common macros run OFM:WASlib() run OFM:WLSlib() run RDA:INVinfo() run RDA:library() # Load the plugin information var $set = ${CUR.O_SETUP} var (@req,%grp) = $set->search('WREQ_\w+_DOM') loop $req (@req) var $grp{field('\.',0,$req->get_path($set))} = 1 loop $pkg ('OFM:OFMdft',getPackages('^OFM\w+\.ctl$','^OFMdft\.',keys(%grp))) run &{concat($pkg,'-Init')}($PLUGIN) # Define a macro to check if a focus area is applicable for the current target macro chk_area {var ($nam,$lst) = @arg import $PRE keep $PRE if @tid = getFocus($nam,$lst) {var $pre = setPrefix($PRE) call switchToc(@tid) call setPrefix($pre) return true } return false } # Analyze the domain collection requests loop $req (@req) {var $tid = substr($req->get_oid,5) var $dom = $req->get_first('I_DOMAIN')->get_first('D_DOMAIN_HOME') next !?testDir('d',$dom) if missing($DOMAINS{$dom}) var $DOMAINS{$dom} = addTarget($req->get_first('I_DOMAIN')) var $tgt = $DOMAINS{$dom} call $tgt->set_focus($tid,$req->get_first('T_DOM_FOCUS')) call $tgt->set_server($tid,[$req->get_value('T_SERVERS')]) if ?$par = $tgt->get_wl_home {if match($tid,'_DOM_') var $tid = replace($tid,'_DOM.*',concat('_',$par->get_oid)) else var $tid = replace($tid,'_DOM','_WH') call $par->set_focus($tid,$req->get_first('T_TOP_FOCUS')) } } # Get the node manager connection details loop $key (keys(%DOMAINS)) {# Skip when not requested call setCurrent($tgt = $DOMAINS{$key}) next !getFocus('WlstNmOn') var @tid = last # Get the domain details var ($hst,$prt) = () var $dom = nvl(getDomain('nam'),'') var $dhp = catDir(getDomain('.')) # Get the host and port if loadFile(catFile($dhp,'nodemanager','nodemanager.properties')) {if grepLastFile('^ListenAddress=','fi') var $hst = value(first) if grepLastFile('^ListenPort=','fi') var $prt = value(first) } if !length($hst) var $hst = 'localhost' if !match($prt,'^\d+$') var $prt = 5556 var $URL{$dhp} = [concat($hst,':',$prt)] # Load known users and passwords var (@pwd,@usr,%pwd) = () loop $tid (@tid) {if length($usr = \ ${CUR.O_SETUP}->search(concat('WREQ_',$tid))->get_first('T_USER')) {if hasPassword('wls',$dom,$usr) {var $pwd{$usr} = true call push(@pwd,$usr) } else call push(@usr,$usr) } } # Check for the "best" candidate var $dft = 'weblogic' if exists($pwd{$dft}) var $LOGIN{$dhp} = $dft elsif @pwd var $LOGIN{$dhp} = $pwd[0] elsif @usr {call setPassword('wls',$dom,$usr[0],askPassword(concat("Enter '",$usr[0],\ "' user node manager password for '",$dom,"' domain:"))) var $LOGIN{$dhp} = $usr[0] } elsif match($dft,'^\w+$') {call setPassword('wls',$dom,$dft,askPassword(concat("Enter '",$dft,\ "' user node manager password for '",$dom,"' domain:"))) var $LOGIN{$dhp} = $dft } } # Get the WebLogic connection details loop $key (keys(%DOMAINS)) {# Skip when not requested call setCurrent($tgt = $DOMAINS{$key}) next !getFocus('WlstOn') var @tid = last var ($ADMIN,$OVERRIDE_PORT,$hst,$prt,$ssl) = ('',0,'',undef,0) # Get the domain details var $dom = nvl(getDomain('nam'),'') var $dhp = catDir(getDomain('.')) # Get the host and port if ?testFile('fr',catFile($dhp,'config','config.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) if compare('EQ',$dom,xmlData(xmlFind($obj,'domain/name'))) {var $ADMIN = xmlData(xmlFind($obj,'domain/admin-server-name')) if match(xmlData(xmlFind($obj,\ 'domain/administration-port-enabled')),'true',true) {if xmlFind($obj,concat('domain/server|name *="^',verbatim($ADMIN),'$"')) {if xmlFind(last,'administration-port') var $OVERRIDE_PORT = xmlData(last) } if !$OVERRIDE_PORT var $OVERRIDE_PORT = xmlData(xmlFind($obj,'domain/administration-port')) } loop $xml (xmlFind($obj,'domain/server')) {if compare('eq',xmlData(xmlFind($xml,'name')),$ADMIN) {var $hst = xmlData(xmlFind($xml,'listen-address')) if !length($hst) var $hst = 'localhost' var $prt = cond(\ $OVERRIDE_PORT,$OVERRIDE_PORT,xmlData(xmlFind($xml,'listen-port'))) if xmlFind($xml,'ssl') {var ($nod) = last if match(xmlData(xmlFind($nod,'enabled')),'true',true) {if $OVERRIDE_PORT var $ssl = $OVERRIDE_PORT elsif !length($ssl = xmlData(xmlFind($nod,'listen-port'))) var $ssl = 7002 } } break } } } } # Still host and port not found while hasDomainAttr() {# Validate the configuration settings if !length($hst) {var $hst = getDomainAttr('SERVER_HOST') if !length($hst) {echo "Missing host for a Oracle WebLogic Server connection under '",\ $dom,"' domain" break } } if !match($hst,'^[\w\-\.]+$') {echo "Invalid Oracle WebLogic Server host under '",$dom,"' domain" break } if !match($prt,'^\d+$') {var $prt = getDomainAttr('SERVER_PORT') if !match($prt,'^\d+$') var $prt = 7001 } var $URL{$dhp} = [concat($hst,':',$prt)] if $ssl var $URL{$dhp} = [concat('t3s://',$hst,':',$ssl),@{$URL{$dhp}}] break } # Load known users and passwords var (@pwd,@usr,%pwd) = () loop $tid (@tid) {if length($usr = \ ${CUR.O_SETUP}->search(concat('WREQ_',$tid))->get_first('T_USER')) {if hasPassword('wls',$dom,$usr) {var $pwd{$usr} = true call push(@pwd,$usr) } else call push(@usr,$usr) } } # Check for the "best" candidate var $dft = getDomainAttr('DOMAIN_USER') if exists($pwd{$dft}) var $LOGIN{$dhp} = $dft elsif @pwd var $LOGIN{$dhp} = $pwd[0] elsif @usr {call setPassword('wls',$dom,$usr[0],askPassword(\ concat("Enter '",$usr[0],"' user password for '",$dom,"' domain:"))) var $LOGIN{$dhp} = $usr[0] } elsif match($dft,'^\w+$') {call setPassword('wls',$dom,$dft,askPassword(\ concat("Enter '",$dft,"' user password for '",$dom,"' domain:"))) var $LOGIN{$dhp} = $dft } } =head1 MIDDLEWARE HOME COLLECTIONS Performs the following collections on all requested Middleware homes: =cut echo 'This can take time. Be patient ...' var $CNT = 0 loop $oid (listTargets('WH')) {var $tgt = getTarget($oid) # Skip when not existing or not requested next !?$WLS_TOP = testDir('d',$tgt->get_mw_home('.')) next !?$WL_HOME = testDir('d',$tgt->get_wl_home('.')) next !$tgt->get_focus call switchToc(last) call setCurrent($tgt) call setPrefix($pre = concat($PRE,'o',incr($CNT))) var $WLST_DIR = catDir($WL_HOME,'common') # Get the WebLogic Server version var $WLS_V12 = cond(compare('VALID',$WLS_VER = $tgt->get_version,'12'),1,0) =head2 abbr - Abbreviations Displays the RDA abbreviations defined for the Middleware home collection. =cut report abbr prefix {write '---+ Middleware 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. =cut if or(chk_area('Generic'),chk_area('OhsGeneric')) {if ?nvl(testDir('d',catDir($dir = $WLS_TOP,'inventory')),\ testDir('d',catDir($dir = $WL_HOME,'inventory'))) {debug ' Inside WREQ module, processing Product Information (can take time)' report product_info prefix {write '---+!! Oracle WebLogic Server Home Product Information' write '---## From ',encode($dir),' ' write $TOC } call inventory_details(lastTestDir(),true) if isCreated(true) {toc '2:[[',getFile(),'][rda_report][Product Information]]' share 'WREQ_PRD_INFO','Product Information' } } =head2 product_sets - Product Feature Sets Gathers the product feature sets information. =cut if ?nvl(testFile($CHK,\ catFile($dir = $WLS_TOP,'oui','bin',${AS.CMD:'viewInventory'})),\ testFile($CHK,\ catFile($dir = $WL_HOME,'oui','bin',${AS.CMD:'viewInventory'}))) {debug ' Inside WREQ module, gathering product feature sets' report product_sets prefix {write '---+ Oracle Home Product Feature Sets' write '---## Using: ',encode($cmd) } call writeCommand($cmd = lastTestFile()) if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Product Feature Sets]]' share 'WREQ_PRD_SETS','Product Feature Sets' } } =head2 wls_version - Oracle WebLogic Server Version Gets the Oracle WebLogic Server version. =cut var $env = sourceContext(catNative($WL_HOME,'server','bin',\ ${AS.CMD:'setWLSEnv'})) var $pgm = undef if and(defined($jdk = getWlHome('jdk')),\ defined(testFile($CHK,catFile($jdk,'bin',${AS.EXE:'java'})))) var $pgm = lastTestCommand() elsif and(defined($jdk = getMwHome('jdk')),\ defined(testFile($CHK,catFile($jdk,'bin',${AS.EXE:'java'})))) var $pgm = lastTestCommand() elsif and(defined($jdk = getCommon('jdk')),\ defined(testFile($CHK,catFile($jdk,'bin',${AS.EXE:'java'})))) var $pgm = lastTestCommand() elsif findDir($WLS_TOP,'^(jdk\d+|jrockit_\d+)','fp') {if ?testFile($CHK,catFile(first(last),'bin',${AS.EXE:'java'})) var $pgm = lastTestCommand() } if !?$pgm {if ?findCommand('java') var $pgm = last } if ?$pgm {if chk_area('Generic') {debug ' Inside WREQ module, gathering Oracle WebLogic Server version' report wls_version var $cmd = concat($pgm,' weblogic.version -verbose 2>&1') prefix {write '---+ Oracle WebLogic Server Version Information' write '---## Gathered by running: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Oracle WebLogic Server Version]]' share 'WREQ_WLS_VER','Oracle WebLogic Server Version' } } =head2 jdk_ver - JDK Version Gets the Java Development Kit version. =cut debug ' Inside WREQ module, gathering JDK version' report jdk_ver var $cmd = concat($pgm,' -version 2>&1') prefix {write '---+ JDK Version' write '---## Gathered by running: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {toc '2:[[',getFile(),'][rda_report][JDK Version]]' share 'WREQ_JDK_VER','JDK Version' } } call restoreContext($env) =head2 classpath - Class Path Information Gathers the list of C<*.jar> files used in the C environment variable. =cut debug ' Inside WREQ module, gathering class path information' report classpath title '---+ Class Path Information' title '---## Information Taken from ``CLASSPATH`` Environment Variable' title '|*Path*|*Exists?*|' loop $pth (@{ENV.CLASSPATH}) {if ?testFile('f',$pth) write '|',$pth,' |%BLUE%Yes%ENDCOLOR% |' elsif ?testDir('d',$pth) {loop $fil (grepDir(last,'\.jar$','dir')) write '|',$fil,' |%BLUE%Yes%ENDCOLOR% |' } else write '|',$pth,' |%RED%No%ENDCOLOR% |' } if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Class Path Information]]' } =head2 Installation and Configuration Files Gathers the Oracle WebLogic Server configuration and installation log files. =cut debug ' Inside WREQ module, gathering install and configuration information' pretoc '2:Installation and Configuration Files' var $FCP{catFile($WLS_TOP,'logs','log.txt')} = $FCP call sort_files(3,0,lastFile(),\ catFile($WLS_TOP,'license.bea'),\ catFile($WLS_TOP,'registry.xml')) unpretoc } =head2 WLS and WLST Administration Scripts Gathers the Oracle WebLogic Server and Oracle WebLogic Scripting Tool-related administration scripts. =head2 wlst_cmd_list - WLST Command Files List Lists the Oracle WebLogic Scripting Tool-related command files. =cut debug ' Inside WREQ module, collecting the WLST start scripts' var @tbl = () if chk_area('Basic') call push(@tbl,\ grepDir(catDir($WL_HOME,'server','bin'),\ '^(setWLSEnv|startNodeManager)\.','p'),\ grepDir(catDir($WLST_DIR,'bin'),\ '^(commEnv|config|startManagedWebLogic|wlscontrol)\.','p')) elsif chk_area('Generic') call push(@tbl,catFile($WL_HOME,'.product.properties'),\ catFile($WL_HOME,'common','bin',${AS.CMD:'commEnv'}),\ catFile($WLS_TOP,'install','envVars.properties'),\ catFile($WLS_TOP,'oui','bin',${AS.CMD:'compareInventory'}),\ catFile($WLS_TOP,'oui','bin',${AS.CMD:'install'}),\ catFile($WLS_TOP,'oui','bin',${AS.CMD:'viewInventory'}),\ catFile($WLS_TOP,'utils','bsu',${AS.CMD:'bsu'}),\ catFile($WLS_TOP,'utils','quickstart',${AS.CMD:'quickstart'}),\ catFile($WLS_TOP,'utils','uninstall',${AS.CMD:'uninstall'}),\ grepDir(catDir($WL_HOME,'server','bin'),'.','p'),\ grepDir(catDir($WLST_DIR,'bin'),'.','p')) pretoc '2:WLS and WLST Administration Scripts' call sort_files(3,0,@tbl) unpretoc if chk_area('Generic') {debug ' Inside WREQ module, listing the WLST command files' var $dir = catDir($WLST_DIR,'wlst') report wlst_cmd_list prefix {write '---+ List of WLST Command Files' write '---## Information Taken from ',encode($dir) } call statFile('b',grepDir($dir,'\.py$','p')) if isCreated(true) toc '2:[[',getFile(),'][rda_report][WLST Command Files List]]' =head2 smart_update - Smart Update Information Gets the smart update information using the C command. =cut if $dir = testDir('d',catDir($WLS_TOP,'utils','bsu')) {debug ' Inside WREQ module, gathering smart update details' var $max = expr('*',$DFT_TIMEOUT,$BSU_FACTOR) if expr('>=',$max,60) debug ' Smart update command collection can take ',expr('/',$max,60),\ ' minute(s) to complete' elsif expr('<=',$max,0) debug ' Smart update command collection can take minutes to complete' report smart_update prefix write '---+ Smart Update Information' if isUnix() {var $opt = concat(' -report -bea_home=',quote($WLS_TOP)) write '---## Using: ',concat(catFile($dir,'bsu.sh'),$opt) var $job = createTemp('PCH','.sh',true) call writeTemp('PCH','cd ',quote($dir)) call writeTemp('PCH','./bsu.sh',$opt) call closeTemp('PCH') call writeCommand($job,true,$BSU_FACTOR) call unlinkTemp('PCH') } elsif and(or(isCygwin(),isWindows()),match($WLS_TOP,'^[^"]+$')) {var $opt = concat(' -report -bea_home="',getNativePath($WLS_TOP),'"') write '' write '---## Using: ',concat(catFile($dir,'bsu.cmd'),$opt) var $job = createTemp('PCH','.bat',true) call writeTemp('PCH','@echo off') call writeTemp('PCH','cd /d "',getNativePath($dir),'"') call writeTemp('PCH','bsu.cmd',$opt) call closeTemp('PCH') call writeCommand($job,true,$BSU_FACTOR) call unlinkTemp('PCH') } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Smart Update Information]]' } =head2 patch_list - Applied Patch List Lists the applied Oracle WebLogic Server patches. =cut if grepDir($WLS_TOP,'^patch_(weblogic|wls)\d*$','p') {var ($dir) = (last) if ?testDir('r',catDir($dir,'patch_jars')) {debug ' Inside WREQ module, list the applied patches' report patch_list var $sub = lastDir() prefix {write '---+ List of Patches Applied' write '---## Information Taken from ',encode($sub) } call statFile('b',grepDir($sub,'^(bug|CR)\d{6,}_?\d*.*?\.jar$','ipt')) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Applied Patch List]]' } =head2 patch_registry - Patch Registry Displays the F file. =cut if ?testFile('r',catFile($dir,'registry','patch-registry.xml')) {debug ' Inside WREQ module, gathering patch registry' report patch_registry var $fil = lastFile() prefix {write '---+ Patch Registry Details' write '---## Information Taken from ',encode($fil) } call statFile('b',$fil) call writeFile($fil) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Patch Registry]]' } } =head2 Node Manager Information Gathers the Node Manager configuration and log files information. =cut debug ' Inside WREQ module, gathering node manager config and log files' pretoc '2:Node Manager Information' if ?testFile('fr',\ catFile($WL_HOME,'common','nodemanager','nodemanager.properties')) {report node_config write '---+ Nodemanager StartScriptEnabled Property Information' write '---## Information Taken from ',encode(lastFile()) if match(value(grepFile(lastFile(),'^StartScriptEnabled','fi')),\ '^true$',true) write ' * ``StartScriptEnabled`` property is set to ``true``.' else {write ' * ``StartScriptEnabled`` property is set to ``false``.' if isUnix() write 'Note: Set the property value to ``true`` using ``setNMProps.sh`` \ script.%BR%' } toc '3:[[',getFile(),'][rda_report][Node Manager StartScriptEnabled]]' } var $dir = catDir($WL_HOME,'common','nodemanager') pretoc '3:Configuration Files' call skip_files(catFile($dir,'nm_data.properties')) call sort_files(4,0,grepDir($dir,'\.log','npv')) unpretoc # Gather log files if $LOG_FILES {pretoc '3:Log Files' call sort_files(4,$TAIL,grepDir($dir,'\.log\d*$','np')) unpretoc } unpretoc } =head2 Manifest Information Gathers the Middleware home manifest information. =cut if chk_area('Manifest') {debug ' Inside WREQ module, getting Middleware home manifest information \ (can take time)' pretoc '2:Manifest Information' loop $dir (catDir($WLS_TOP,'modules'),$WL_HOME) call dsp_manifest(3,$dir) unpretoc } # Restore module prefix call setPrefix($PRE) } =head1 DOMAIN HOME COLLECTIONS Performs the following collections on all requested domain homes: =cut var $CNT = 0 loop $key (keys(%DOMAINS)) {# Skip when not requested call setCurrent($tgt = $DOMAINS{$key}) next !getFocus() call switchToc(@tid = last) call setPrefix($pre = concat($PRE,'d',incr($CNT))) # Get the domain details var $dom = nvl(getDomain('nam'),'') var $dhp = catDir(getDomain('.')) var $dtp = catDir(getDomain('top')) var $lsd = catDir($dtp,$dom,'servers') var $TOPOLOGY{$dhp} = [$dtp,$dom] debug ' Inside WREQ module, analyzing domain ',$dom # Oracle home initialization var $ORACLE_HOME = nvl(getHome('.'),'') # Execute the product-specific initialisation code loop $prd (keys($PLUGIN->{'WLS','ini'})) run &{$PLUGIN->{'WLS','ini',$prd}}($dhp,$dom) # Determine WLST if $tgt->get_wlst(true) {var $WLST_DIR = catDir(last,'common') call setWasType('WLS',catCommand($WLST_DIR,'bin',${AS.CMD:'wlst'})) } else call setWasType('WLS') =head2 abbr - Abbreviations Displays the RDA abbreviations defined for the WLS domain collection. =cut report abbr prefix {write '---+ Domain 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 Domain Level MBeans Collects Oracle WebLogic domain level run-time-related information. =head3 Servers Collects domain-wide server management objects information (such as the list of C managed under the domain). =head3 Clusters Collects domain-wide cluster management objects information (such as the number of C managed under the cluster). =head3 Domain Configuration Collects domain-wide configuration management objects information (such as C, C, C, C, C, and C). =for stopwords Runtime =head3 Domain Runtime Collects domain-wide run-time management objects information (such as C, C, C, C, C, and C). It requires the availability of the Oracle WebLogic Scripting Tool (WLST). =cut # Load the library on first usage if !isImplemented('col_log_exports') run OFM:WLSrun() if chk_area('WlstNmOn') {toc '%TITLE("2:Domain Level MBeans")%' # Check the connection to the node manager var ($nm,$msg) = (false) debug ' - Inside WREQ module, checking connection to the node manager' output F,nm_error if $URL{$dhp} {var ($url) = @{last} call sharePassword('wls',$dom,'wls',$url) if setWasLogin($LOGIN{$dhp},undef,$url,$dom,catDir($dtp,$dom)) write '**Missing access to WLST**' var $out = newTemp('out') var $err = newTemp('err') call requestWas(undef,undef,$out,$err) if grepFile($out,'Successfully connected ','fi') var $nm = true else {write "**Error encountered when connecting to the node manager from \ the '",$dom,"' domain using: ",$url,'**' write if ?testFile('s',$err) call writeFile($err,['C','wlst (stderr)']) else call writeFile($out,['C','wlst (stdout)']) call loadFile($out) if grepLastFile('Access to domain ','f') var $msg = "\012Error: Invalid username/password\012" elsif grepLastFile('Could not connect to NodeManager','f') var $msg = "\012Error: Destination unreachable\012" } call unlinkTemp('out') call unlinkTemp('err') } else write '**No node manager connection URLs identified**' if !$nm {echo tput('reverse'),\ "Error encountered when connecting to the node manager of '${VAR.dom}'",\ nvl($msg,' '),\ "Note:\012\ * Runtime MBean information will not be collected.\012\ * RDA collection of files, logs, and other data will continue.\012\ * Upon completion, review the connection error via the \ RDA__start.htm:\012\040\ -> '${VAR.dom}' Domain\012\040\ Sub Index:\012\040\ -> Domain Level MBeans\012\040\ --> Node Manager Connection Error",tput('off') toc '3:[[',getFile(),'][rda_report][Node Manager Connection Error]]' } toc '%UNTITLE%' } if chk_area('WlstOn') {# Identify the AdminServer if ?testFile('fr',catFile($dhp,'config','config.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) if compare('EQ',$dom,xmlData(xmlFind($obj,'domain/name'))) var $ADMIN = xmlData(xmlFind($obj,'domain/admin-server-name')) } # Try identifying AdminServer for second attempt while hasDomainAttr() {if !length($ADMIN) var $ADMIN = getDomainAttr('SERVER_NAME') break } # Check the connection to the WLS var ($wls,$msg) = (false) debug ' - Inside WREQ module, checking connection to Oracle WebLogic \ server' output F,wls_error if $URL{$dhp} {loop $url (@{last}) {call sharePassword('wls',$dom,'wls',$url) if setWasLogin($LOGIN{$dhp},undef,$url) {write '**Missing access to WLST**' break } var $out = newTemp('out') var $err = newTemp('err') call requestWas(undef,undef,$out,$err) if grepFile($out,'Successfully connected ','f') var $wls = true elsif grepFile($out,'javax\.net\.ssl\.SSL(Key|Handshake)Exception','f') {# Adapt the WLST environment var @prp = ('-Dweblogic.security.SSL.ignoreHostnameVerification=true') if ?testFile('f',catFile($WL_HOME,'server','lib','DemoTrust.jks')) call push(@prp,'-Dweblogic.security.TrustKeyStore=DemoTrust') var $bkp = setContext({\ WLST_PROPERTIES => $val = join(' ',@prp,${SYS.WLST_PROPERTIES})}) var $tst = newTemp('sslout') call requestWas(undef,undef,$tst,newTemp('sslerr')) if grepFile($tst,'Successfully connected ','f') var ($wls,$ENV{$dhp,'WLST_PROPERTIES'}) = (true,$val) call unlinkTemp('sslout') call unlinkTemp('sslerr') call restoreContext($bkp) } if !$wls {write "**Error encountered when connecting to the Oracle WebLogic Server \ from the '",$dom,"' domain using: ",$url,'**' write if ?testFile('s',$err) call writeFile($err,['C','wlst (stderr)']) else call writeFile($out,['C','wlst (stdout)']) call loadFile($out) if grepLastFile('AuthenticationException ','f') var $msg = "\012Error: Invalid username/password\012" elsif grepLastFile('CommunicationException ','f') var $msg = "\012Error: Destination unreachable\012" } call unlinkTemp('out') call unlinkTemp('err') break $wls } } else write '**No connection URLs identified**' if !$wls {echo tput('reverse'),\ "Error encountered when connecting to the Admin Server of '${VAR.dom}'",\ nvl($msg,' '),\ "Note:\012\ * Runtime MBean information will not be collected.\012\ * RDA collection of files, logs, and other data will continue.\012\ * Upon completion, review the connection error via the \ RDA__start.htm:\012\040\ -> '${VAR.dom}' Domain\012\040\ Sub Index:\012\040\ -> Domain Level MBeans\012\040\ --> Oracle WebLogic Server Connection Error",tput('off') toc '2:Domain Level MBeans' toc '3:[[',getFile(),\ '][rda_report][Oracle WebLogic Server Connection Error]]' } # Adapt the WLST environment var $bkp = setContext($ENV{$dhp}) if $wls {# Collect the domain online summary if chk_area('WlstOnSum') call col_on_domain_summary($dom) # Collect the server details toc '%TITLE("2:Domain Level MBeans")%' if chk_area('WlstDomSrv') call col_servers($dom) # Collect the cluster details if chk_area('WlstDomClu') call col_cluster($dom) # Collect the domain configuration details if chk_area('WlstDomCfg') call col_dom_config($dom,$PLUGIN) # Collect the domain run-time details if chk_area('WlstDomRun') call col_dom_runtime($dom,$PLUGIN) toc '%UNTITLE%' } } =head2 Domain MBeans Summary Collects Oracle WebLogic domain level MBeans summary information in offline mode (such as the list of C, C, C, C managed under the domain). It requires the availability of the Oracle WebLogic Scripting Tool (WLST). =cut if and(not($wls),chk_area('WlstOff')) {call setWasLogin('') if chk_area('WlstOffSum') call col_off_domain_summary($dom,$dhp) if chk_area('WlstOffMB') {toc '%TITLE("2:Domain MBeans Summary")%' call col_off_domain($dom,$dhp) toc '%UNTITLE%' } } =head2 Local Log Files Gathers domain-wide Oracle WebLogic Server-related log files from the F<$DOMAIN_HOME> directory structure. =cut # Collect the product specific details if $LOG_FILES {loop $fcs (keys($PLUGIN->{'WLS','domlog'})) {if chk_area($fcs) run &{$PLUGIN->{'WLS','domlog',$fcs}}($dhp,$TAIL) } } =head2 jdbc_config - JDBC System Resources Configuration Gathers the Oracle WebLogic Server-related JDBC system resources configuration information. =cut debug ' - Inside WREQ module, collecting the JDBC system resources config' if ?$fil = testFile('fr',catFile($dhp,'config','config.xml')) {report jdbc_config title '---+ JDBC System Resources Configuration' title '---## Information extracted from ',encode($fil) title '|*Name*|*Target*|*Descriptor File Name*|' var $obj = xmlLoadFile($fil,xmlDisable(xmlParser(),'BCDEPR')) loop $xml (xmlFind($obj,'domain/jdbc-system-resource')) {next !?$nam = $xml->find('name')->get_data var $tgt = $xml->find('target')->get_data var $pth = $xml->find('descriptor-file-name')->get_data var $lnk = encode($pth) if ??$pth {if !isAbsolute($pth = catFile($pth)) {if ?nvl(testFile('f',catFile($dhp,'config',$pth)),\ testFile('f',catFile($dhp,$pth))) var $pth = last } var $rpt = $[OUT]->add_report('d',basename($pth),0) if $rpt->write_data($pth) var $lnk = concat('[[',$rpt->get_raw(true),'][_blank][',$lnk,']]') end $rpt } write '|',$nam,' |',$tgt,' |',$lnk,' |' } if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][JDBC System Resources Configuration]]' share 'WREQ_JDBC_CONFIG','JDBC System Resources Configuration' } } =head2 Common Configuration Files Gathers domain-wide Oracle WebLogic Server-related configuration files from the F<$DOMAIN_HOME> and the F<$DOMAIN_HOME/config> directory structures. =cut # Collect common configuration, product specific details debug ' - Inside WREQ module, collecting domain configuration files' loop $cfg ('domnodcfg','domcfg','domext','domprd') {loop $fcs (keys($PLUGIN->{'WLS',$cfg})) {if chk_area($fcs) run &{$PLUGIN->{'WLS',$cfg,$fcs}}($dhp) } } =head2 Start Scripts Gathers the Oracle WebLogic Server-related start scripts. =cut debug ' - Inside WREQ module, collecting the start scripts' pretoc '2:Start Scripts' call sort_files(3,0,\ grepDir(catDir($dhp,'bin'),'\.(cmd|sh)$','p'),\ grepDir(catDir($dhp,'bin','nodemanager'),'\.(cmd|sh)$','p')) # Collect the custom scripts if used if length($CUSTOM_SCRIPTS_DIR) {pretoc '3:Custom Start Scripts' call sort_files(4,0,\ grepDir($CUSTOM_SCRIPTS_DIR,'\.(bash|cmd|pl|py|sh)$','dr',1)) unpretoc } unpretoc =head1 SERVER HOME COLLECTIONS Performs the following collections on all requested server homes: =cut loop $srv (grepDir(catDir($dhp,'servers'),'^[^\.]','n'),\ grepDir(catDir($dhp,'servers_coherence'),'^[^\.]','n')) {next !?nvl(testDir('d',catDir($dhp,'servers',$srv,'logs')),\ testDir('d',catDir($dhp,'servers_coherence',$srv,'logs'))) # Skip not requested servers next !chk_area(undef,[@fcs = getServer($srv)]) # Initialize the server collections debug ' - Inside WREQ module, analyzing server ',$srv if ?testDir('d',catDir($dtp,$dom,'servers_coherence',$srv)) var $lsd = catDir($dtp,$dom,'servers_coherence') call setSymbol('$SH',catDir($lsd,$srv)) pretoc '%SPLIT%' pretoc "1++:'",encode($srv),"' Server" var $shp = getShortPath(\ nvl(testDir('d',catDir($dhp,'servers',$srv)),\ testDir('d',catDir($dhp,'servers_coherence',$srv)))) # Check for server log location definition var $slp = catDir($shp,'logs') # Server default logs path if ?testFile('fr',catFile($dhp,'config','config.xml')) {var $obj = xmlLoadFile(last,xmlDisable(xmlParser(),'BCDEPR')) if compare('EQ',$dom,xmlData(xmlFind($obj,'domain/name'))) {if xmlFind($obj,'domain/log/file-name') {if and(length($log = xmlData(last)),isAbsolute($log)) var $ddl = dirname($log) # Domain defined log path } loop $xml (xmlFind($obj,'domain/server')) {next !compare('EQ',$srv,xmlData(xmlFind($xml,'name'))) break !xmlFind($xml,'log/file-name') if and(length($log = xmlData(last)),isAbsolute($log)) break $sdl = dirname($log) # Server defined log path } } } # Check for server diagnostics logging location definition if ?testFile('fr',\ catFile($dhp,'config','fmwconfig','servers',$srv,'logging.xml')) {if xmlFind(xmlLoadFile(last,xmlDisable(xmlParser(),'BCDEPR')),\ 'logging_configuration/log_handlers/log_handler name="^odl-handler$"') {if xmlFind(last,'property name="^path$"') {var $log = replace(replace(xmlValue(last,'value'),\ '\$\{weblogic\.Name\}',$srv,true),\ '\$\{domain\.home\}',$dhp) if and(length($log),isAbsolute($log)) var $odl = dirname($log) # Server diagnostics logging defined path } } } =head2 abbr - Abbreviations Displays the RDA abbreviations defined for the server home collection. =cut output F,abbr prefix {write '---+ Server 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 Server Level MBeans Collects Oracle WebLogic server level run-time-related information. =head3 Server Configuration Collects server configuration management objects information. =head3 Server Runtime Collects server run-time management objects information. =head3 Diagnostic Images Uses the Diagnostic Image Capture component of the Oracle WebLogic Diagnostic Framework (WLDF) to create a diagnostic snapshot or dump of a server's internal run-time state at the time of the capture. =head3 Log Exports Gathers Oracle WebLogic Server-related log information. It executes a query against the specified log file and retrieves the exported Oracle WebLogic Diagnostic Framework (WLDF) data. RDA uses C in connected mode and C in off-line mode. The C collects data with the default options. It requires the availability of the Oracle WebLogic Scripting Tool (WLST). =head3 Product Specific Information Collects product-specific information. =cut # Focus based on node manager connection if chk_area('WlstNmOn',[@fcs]) {toc '%TITLE("2:Server Level MBeans")%' if $nm {# Collect the server run-time details if chk_area('WlstNmSrvRun',[@fcs]) call col_nm_srv_runtime($dom,$srv) } toc '%UNTITLE%' } # Focus based AdminServer connection if chk_area('WlstOn',[@fcs]) {toc '%TITLE("2:Server Level MBeans")%' var (%hst,%prt) = () if $wls {# Set the login to AdminServer call setWasLogin($LOGIN{$dhp},undef,$url) # Collect the server port information call col_srv_prt(\%hst,\%prt,$srv) if !length($hst{$srv}) var $hst{$srv} = 'localhost' # Collect the server configuration details if chk_area('WlstSrvCfg',[@fcs]) call col_srv_config($dom,$srv,$PLUGIN) # Collect the server run-time details if chk_area('WlstSrvRun',[@fcs]) call col_srv_runtime($dom,$srv,$PLUGIN) # Share the credentials for managed servers call sharePassword('wls',$dom,'wls',concat($hst{$srv},':',$prt{$srv})) # Collect the diagnostic images if and($DIAG_IMAGES,chk_area('WlstSrvImg',[@fcs]),not(isFiltered())) call col_diag_images($dom,$srv,$hst{$srv},$prt{$srv},$LOGIN{$dhp}) # Collect the thread dumps if and($THREAD,chk_area('WlstSrvThd',[@fcs])) call col_thread_dump($dom,$srv,$hst{$srv},$prt{$srv},$LOGIN{$dhp}) } # Collect the log export data if and(chk_area('WlstSrvExp',[@fcs]),not(isFiltered())) call col_log_exports($wls,$dom,$srv,$hst{$srv},$prt{$srv},$LOGIN{$dhp}) # Collect the product specific details if $wls {loop $fcs (keys($PLUGIN->{'WLS','col'})) {if chk_area($fcs,[@fcs]) run &{$PLUGIN->{'WLS','col',$fcs}}(\ $dom,$srv,$hst{$srv},$prt{$srv},$LOGIN{$dhp}) } } toc '%UNTITLE%' } =head2 Log Files Gathers server-wide Oracle WebLogic Server-related log files. =head3 JDK Information from Log Files Gathers the JDK-related information found in the server log files since the last start. =head3 Patches from Log Files Displays the patches found in the server log files since the last start and lists the server log files. =cut macro search_patches {var (\$beg,\%inf,\%ptc,$fil) = @arg if createBuffer('LOG','R',$fil) {var %cur = () # Macro to extract patch list from log line macro add_patch {var (\%cur,$lin) = @arg var ($str,undef,undef,undef,$dat) = \ match($lin,'((CR)?\d{6,}(,\s*(CR)?\d{6,})*)\s+(.*)$',true) loop $itm (split(',\s*',$str)) var $cur{uc($itm)} = $dat return -1 } # Parse the log file call parseReset() call parsePattern('TOP',\ 'Temporary Patch for ([Cc][Rr])?\d{6,}',\ add_patch(\%cur,line),\ '^#{4}<(.*?)>.*?<(Starting )?WebLogic Server',\ eval(($beg,%cur) = parseHit(0),-1),\ '^(WebLogic Server.*?)\s*\(c\)',\ eval($inf{'ver'} = parseHit(0),-1),\ '^java\.class\.path\s*=\s*(.*)',\ eval($inf{'cls'} = parseHit(0),-1),\ '^java\.library\.path\s*=\s*(.*)',\ eval($inf{'lib'} = parseHit(0),-1)) call parsePattern('TOP',\ '^java\.io\.tmpdir\s*=\s*(.*)',\ eval($inf{'tmp'} = parseHit(0),-1),\ '^java\.vendor\s*=\s*(.*)',\ eval($inf{'ven'} = parseHit(0),-1),\ '^java\.version\s*=\s*(.*)',\ eval($inf{'jvv'} = parseHit(0),-1),\ '^java\.vm\.info\s*=\s*(.*)',\ eval($inf{'vmi'} = parseHit(0),-1),\ '^java\.vm\.name\s*=\s*(.*)',\ eval($inf{'vmn'} = parseHit(0),-1),\ '^java\.vm\.version\s*=\s*(.*)',\ eval($inf{'vmv'} = parseHit(0),-1),\ '^sun\.arch\.data\.model\s*=\s*(.*)',\ eval($inf{'arc'} = parseHit(0),-1),\ '^user\.dir\s*=\s*(.*)',\ eval($inf{'vmd'} = parseHit(0),-1),\ '^weblogic\.Name\s*=\s*(.*)',\ eval($inf{'nam'} = parseHit(0),-1),\ '^wls\.home\s*=\s*(.*)',\ eval($inf{'hom'} = parseHit(0),-1),\ '^java\.home\s*=\s*(.*)',\ eval($inf{'jvh'} = parseHit(0),-1),\ 'Listen Address\s*(.*?):(\d+)',\ eval($inf{'prt'} = parseHit(1),-1)) call parse('LOG') call deleteBuffer('LOG') # Accumulate the patches loop $key (keys(%cur)) {if missing($ptc{$key}) var $ptc{$key} = $cur{$key} } } return $beg } macro search_srv_out {var (\%inf,$fil) = @arg var $beg = false if createBuffer('LOG','R',$fil) {# Parse the log file call parseReset() call parsePattern('TOP',\ '^.*?'),' |' } if hasOutput(true) write $TOP toc '3:[[',getFile(),'][rda_report][Patches from Log Files]]' =head3 server_errors - Critical/Emergencies/Errors/Warnings Information Displays the important critical, emergencies, errors, and warnings found in the latest server log file. =cut if chk_area('SrvErr',[@fcs]) {debug ' - Gathering critical, emergencies, errors, and warnings from \ server log file' if createBuffer('LOG','R',$log[0]) {var (%err,%cnt) = () # Define the code block to handle errors / warnings from the log line code add_error = -1 {var @hit = last incr $cnt{@hit} if missing($err{@hit}) {if match(line,\ '<(BEA|IAM|JMX|JPS|MDS|OWS|PKR|SOA|TOPLINK)-\d{4,9}>\s+<(.*?)>?$') var (undef,$err{@hit}) = last } } # Parse the log file call parseReset() call parsePattern('TOP',\ '<(Critical|Emergency|Error|Warning)>.*?\ <((BEA|IAM|JMX|JPS|MDS|OWS|PKR|SOA|TOPLINK)-\d{4,9})>',\ &add_error(parseHit(0),parseHit(1))) call parse('LOG') call deleteBuffer('LOG') # Create the report output F,server_errors title "---+!! '",encode($srv),\ "' Server Critical/Emergencies/Errors/Warnings Information" title '---## Information Extracted from ',encode($log[0]) title $TOC # List the critical errors found prefix {write '---+ Critical Errors' write '|*Error Code*|*Description*| *Count*|' } loop $key (keys($cnt{'Critical'},'ND')) write '|',$key,' |',$err{'Critical',$key},\ ' | ',$cnt{'Critical',$key},'|' if hasOutput(true) write $TOP # List the emergencies found prefix {write '---+ Emergencies' write '|*Error Code*|*Description*| *Count*|' } loop $key (keys($cnt{'Emergency'},'ND')) write '|',$key,' |',$err{'Emergency',$key},\ ' | ',$cnt{'Emergency',$key},'|' if hasOutput(true) write $TOP # List the errors found prefix {write '---+ Errors' write '|*Error Code*|*Description*| *Count*|' } loop $key (keys($cnt{'Error'},'ND')) write '|',$key,' |',$err{'Error',$key},' | ',$cnt{'Error',$key},'|' if hasOutput(true) write $TOP # List the warnings found prefix {write '---+ Warnings' write '|*Error Code*|*Description*| *Count*|' } loop $key (keys($cnt{'Warning'},'ND')) write '|',$key,' |',$err{'Warning',$key},' | ',$cnt{'Warning',$key},'|' if hasOutput(true) write $TOP # Add the report to the table of content if isCreated(true) toc '3:[[',getFile(),\ '][rda_report][Critical/Emergencies/Errors/Warnings Information]]' } } } =head2 server_exceptions - Server Exceptions Displays the exceptions found in the server log files since the last start. =cut if chk_area('SrvExc',[@fcs]) {debug ' - Gathering server exceptions from server log files' var ($beg,%err,%fil) = () if @log = (grepDir($slp,concat('^',verbatim($srv),'\.log\d*'),'ipt'),\ grepDir($sdl,concat('^',verbatim($srv),'\.log\d*'),'ipt')) {# Search for last start loop $fil (@log) {if and(testFile('fr',$fil),createBuffer('LOG','R',$fil)) {if grepBuffer('LOG','^#{4}<(.*?)>.*?<(Starting )?WebLogic Server','o1',-1) var ($fil{$fil},$beg) = split(':',first(last),2) else var $fil{$fil} = undef call deleteBuffer('LOG') break $beg } } # Report the exceptions output F,server_exceptions title "---+!! '",encode($srv),"' Server Exceptions" if ?$beg {title '---## Server Last Start: ',$beg title $TOC # Parse the files to find the exceptions call parseReset() call parsePattern('TOP',\ 'java\.sql\.SQLException: ORA-00020:',\ $err{'prc'} = -1,\ 'ORA-12154: TNS',\ $err{'tns'} = -1,\ 'weblogic\.management\.DeploymentException: Error creating connection \ pool myConnectionPool:\&0:Unable to load locale categories',\ $err{'loc'} = -1,\ '\s*\s*\s*\s*\s* [0],'it')) {next !?testFile('f',catFile($dir,$nam)) next $dup{$fil = last} var $dup{$fil} = true call push(@tbl,$fil) var $FCP{$fil} = $FCP var $LOG{$fil} = cond($ROTATED_LOGS,0,$TAIL) if match($nam,$pat->[1]) {break !$cnt next } break !decr($cnt) } } # Gather log files if $LOG_FILES {debug ' - Collecting the local log files' var ($max,@tbl,%dup,%pat) = ($ROTATED_LOGS) var $pat{'acc'} = 'access\.log\.?\d*$' var $pat{'ddl'} = concat('^',verbatim($dom),'\.log\d*$') var $pat{'odl'} = concat('^',verbatim($srv),'-diagnostic-?\d*\.log$') var $pat{'sdl'} = concat('^',verbatim($srv),'\.log\d*$') var $pat{'sdo'} = concat('^',verbatim($srv),'\.out\d*$') if ?$odl {call get_logs(\@tbl,$max,$odl,\ [$pat{'odl'},\ concat('^',verbatim($srv),'-diagnostic\.log$')]) delete $pat{'odl'} } if ?$ddl {call get_logs(\@tbl,$max,$ddl,\ [$pat{'ddl'},\ concat('^',verbatim($dom),'\.log$')]) delete $pat{'ddl'} } if ?$sdl {call get_logs(\@tbl,$max,$sdl,\ [$pat{'sdl'},\ concat('^',verbatim($srv),'\.log$')]) call get_logs(\@tbl,$max,$sdl,\ [$pat{'sdo'},\ concat('^',verbatim($srv),'\.out$')]) delete $pat{'sdl'},$pat{'sdo'} } loop $pat (values(%pat,'SA')) call get_logs(\@tbl,$max,$slp,\ [$pat,concat('(^access\.log$|^',\ verbatim($dom),'\.log$|^',\ verbatim($srv),'-diagnostic\.log$|^',\ verbatim($srv),'\.log$|^',\ verbatim($srv),'\.out$)')]) toc '%TITLE("3:Common Local Log Files")%' if chk_area('SrvJvm',[@fcs]) # Collect Java fatal and garbage logging files {var ($JAVA_HOME,$pid,$sfc,$sgc) = ($inf{'jvh'}) # Determine the Java home if match(pop(@dir = splitDir($JAVA_HOME)),'^jre$',true) var $JAVA_HOME = catDir(@dir) # Determine the process identifier of the server if isUnix() {if grepCommand($PS_EF,concat('-Dweblogic\.Name=',verbatim($srv)),'f') var $pid = field('\s+',1,first(last)) } else {if ?isPort($inf{'prt'},true) {if grepCommand('netstat -ano',concat(':',last,'\s'),'f') var $pid = field('\s+',4,first(last)) } } # Collect Java fatal and garbage logging files var $pat = concat('^',verbatim($srv)) loop $dir ($slp,$sdl) {loop $fil (grepDir($dir,concat($pat,'\.out$'),'ip')) {if and(testFile('fr',$fil),createBuffer('LOG','R',$fil)) {if !?$sfc {if grepBuffer('LOG','-XX:ErrorFile=(.*?)\s*-','f1',-1) {if isAbsolute($pth = replace(first,'\%p',$pid)) var $sfc = $pth } } if !?$sgc {if grepBuffer('LOG','-Xloggc:(.*?)\s*-','f1',-1) {if isAbsolute($pth = replace(first,'\%p',$pid)) var $sgc = $pth } } call deleteBuffer('LOG') } # Check for size restrictions if !grepDir($dir,concat($pat,'\.out\d+$'),'i') var $LOG{$fil} = $SRVOUT_SIZE } } if ?$sfc call push(@tbl,$sfc) if ?$sgc call push(@tbl,$sgc) } call sort_files(4,$TAIL,grepDir(catDir($slp,'sdp'),'^[^\.]','p'),\ grepDir(catDir($slp,'wlcs'),'^[^\.]','p'),\ @tbl) toc '%UNTITLE%' # Collect the product specific details var $dir = catDir($shp) loop $fcs (keys($PLUGIN->{'WLS','srvlog'})) {if chk_area($fcs,[@fcs]) run &{$PLUGIN->{'WLS','srvlog',$fcs}}($dir,$TAIL) } } unpretoc # Collect Java-related information if chk_area('SrvJvm',[@fcs]) {if match($pid,'^(\d+)$') run OFM:JVMinfo(2,first) } =head2 Problem Overview Gathers diagnostic problems. A problem is a critical error in the Application Server. Critical errors manifest as internal errors. Problems are tracked in the Automatic Diagnostic Repository (ADR), which is a file-based repository for application server diagnostic data. It requires the availability of the ADR Command Interpreter (ADRCI) utility, which is a command-line tool that you use to view diagnostic data within the Automatic Diagnostic Repository. =cut # Define a macro to locate ADRCI macro get_adrci {import $CHK,$ORACLE_HOME,$WL_HOME,$WLS_TOP keep $CHK var $exe = ${AS.EXE:'adrci'} if ?nvl(testFile($CHK,catFile($WLS_TOP,'oracle_common','adr',$exe)),\ testFile($CHK,catFile($WL_HOME,'server','adr',$exe))) return lastTestCommand() if ?findCommand('adrci') return last if ?nvl(testFile($CHK,catFile($ORACLE_HOME,'bin',$exe)),\ testFile($CHK,catFile($ORACLE_HOME,$exe))) return lastTestCommand() var $exe = cond(isWindows(),'^adrci\.exe$',\ isCygwin(), '^adrci\.exe$',\ '^adrci$') var $pat = concat(\ '^(jdk|jrockit|logs|modules|registry|user_projects|utils|wlserver|',\ verbatim(pop(splitDir($ORACLE_HOME))),')') loop $sub (grepDir($WLS_TOP,'^\.+$','vn')) {next match($sub,$pat,true) if grepDir(catDir($WLS_TOP,$sub),$exe,'ir',2) return catCommand(first(last)) } } # Collect ADR information if get_adrci() {var $cmd = last debug ' - Collecting diagnostic repository' pretoc '2:Diagnostic Repository (%ACRONYM:DFW%/%ACRONYM:ADR%)' var $bas = catDir($shp,'adr') var $n_h = 0 loop $hom (findDir([$bas,catDir('diag','ofm')],'incident','rw',2)) {pretoc '3:From ',$hom var $job = createTemp('job') var $out = getTemp('out') var $err = getTemp('err') call writeTemp('job','SET BASE ',$bas) call writeTemp('job','SET HOMEPATH ',$hom) call writeTemp('job','SHOW PROBLEM -ALL -ORDERBY LASTINC_TIME DSC') call writeTemp('job','EXIT') call closeTemp('job') call command(concat($cmd,' script=',$job,' >',$out,' 2>',$err)) output F,diag_problems if ?testFile('z',$out) {write '** No ADR to analyze **' write if ?testFile('s',$err) call writeFile($err,['C','adrci (stderr)']) } elsif createBuffer('ADR','R',$out) {var ($cnt,$min,$cut,$src,$hdr) = (0,0,true) prefix {write "---+ '",encode($srv),"' List of Diagnostic Problems" write '---## Using: SHOW PROBLEM -ALL -ORDERBY LASTINC_TIME DSC' if $src write '---## From: ',replace(encode($src),'\s',' ',true) if $hdr write $hdr } while getLine('ADR') {var $lin = chomp(last) if match($lin,'^ADR Home\s+=\s*(.*):$') var ($cut,$row,$src) = (false,false,last) elsif match($lin,'^DIA\-(\d+):') {if $src write '**',$lin,'**' break } elsif $cut next elsif match($lin,'^\d+\s+rows\s+fetched$') {if !isCreated() {var $hdr = undef write '**No problems found**' } break } elsif $row {next expr('<',length($lin),$min) var @tbl = () for $pos (0,$cnt) var $tbl[$pos] = trim(substr($lin,$tb_off[$pos],$tb_lgt[$pos])) if @tbl write '|',join(' |',@tbl),' |' } elsif match($lin,'^[\-\s]+$') var $row = true elsif match($lin,'^\w+\s+') {var ($min,@tb_key,@tb_lgt,@tb_off) = (0) var %tbl = ('PROBLEM_ID','Problem ID',\ 'PROBLEM_KEY','Problem Key',\ 'LAST_INCIDENT','Last Incident',\ 'LASTINC_TIME','Last Incident Time') var $lin = trim($lin) while match($lin,'^(\w+\s+)') {var ($key) = last var $lgt = length($key) var $key = trim($key) var $tb_key[$cnt] = nvl($tbl{$key},$key) var $tb_off[$cnt] = $min var $tb_lgt[$cnt] = $lgt var $lin = substr($lin,$lgt) incr $min,$lgt incr $cnt } var $tb_key[$cnt] = nvl($tbl{$lin},$lin) var $tb_off[$cnt] = $min if $cnt var $hdr = concat('|*',join('*|*',@tb_key),'*|') } } call deleteBuffer('ADR') } call unlinkTemp('job') call unlinkTemp('out') call unlinkTemp('err') if isCreated(true) toc '4:[[',getFile(),'][rda_report][Problem Overview]]' =head2 Most Recent Incidents Gathers diagnostic incidents. An incident is a single occurrence of a problem. When a problem (critical error) occurs repeatedly, an incident is created for each occurrence. Incidents are time stamped and tracked in the ADR. By default, RDA collects the last 10 incidents. It requires the availability of the ADRCI utility. =cut var $max = $MAX if $max {var ($cut,@inc,%lnk) = (true) # Get the incident list var $job = createTemp('job') var $out = getTemp('out') call writeTemp('job','SET BASE ',$bas) call writeTemp('job','SET HOMEPATH ',$hom) call writeTemp('job',\ 'QUERY (INCIDENT_ID) INCIDENT -ORDERBY CREATE_TIME DSC') call writeTemp('job','EXIT') call closeTemp('job') call command(concat($cmd,' script=',$job,' >',$out)) if createBuffer('ADR','R',$out) {while getLine('ADR') {var $lin = chomp(last) if match($lin,'^-+\s*$') var $cut = false elsif $cut next elsif match($lin,'^(\d+)\s*$') {call push(@inc,last) # Limit the incident number decr $max break !$max } elsif match($lin,'^\d+\s+rows\s+fetched$') break } call deleteBuffer('ADR') } # Get the incident details var $pbm = {} loop $inc (@inc) {var $job = createTemp('job') var $out = getTemp('out') call writeTemp('job','SET BASE ',$bas) call writeTemp('job','SET HOMEPATH ',$hom) call writeTemp('job',\ 'SHOW INCIDENT -MODE DETAIL -P "INCIDENT_ID=',$inc,'"') call writeTemp('job','EXIT') call closeTemp('job') call command(concat($cmd,' script=',$job,' >',$out)) if createBuffer('ADR','R',$out) {output F,concat('incident_',$inc) var ($cut,$src) = (true) prefix {write "---+ '",encode($srv),"' Display of Incident ",$inc write '---## Using: SHOW INCIDENT -MODE DETAIL -P "INCIDENT_ID=',\ $inc,'"' if $src write '---## From: ',replace(encode($src),'\s',' ',true) write '|*Name*|*Value*|' } while getLine('ADR') {var $lin = chomp(last) if match($lin,'^ADR Home\s+=\s*(.*):$') var ($cut,$src) = (false,last) elsif $cut next elsif match($lin,'^\s+\w+\s') {var (undef,$nam,$val) = split('\s+',$lin,3) write '|',$nam,' |',$val,' |' if compare('eq',$nam,'PROBLEM_KEY') var $pbm->{$inc} = $val } elsif match($lin,'^\d+\s+rows\s+fetched$') break } if isCreated(true) {write $TOP var $lnk{$inc} = getHtmlLink(true) } call deleteBuffer('ADR') } call unlinkTemp('job') call unlinkTemp('out') } output F,diag_incidents prefix {write "---+ '",encode($srv),"' Display of Last ",$MAX,' Incidents' write '| *Incident Id*|' } loop $inc (@inc) {if exists($lnk{$inc}) write '| [[',$lnk{$inc},'][_blank][',$inc,']]|' } if isCreated(true) toc '4:[[',getFile(),'][rda_report][Most Recent Incidents]]' } =head2 Files from Latest Incidents Gathers the files generated by the latest incidents. =cut if !match(getRunId(),'^IRDA\.') {var $lnk = 'Files from Latest Incidents' call write_latest_incidents($bas,$hom,concat('i',incr($n_h)),$lnk,4,$pbm) } unpretoc } unpretoc } =head2 jrf_config - JRF Configuration Gathers the Java Required Files (JRF)-related configuration information. =cut if chk_area('ExtSrvCfg',[@fcs]) {debug ' - Checking JRF configuration' output F,jrf_config if ?testFile('fr',catFile($dhp,'config','config.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) if compare('EQ',$dom,xmlData(xmlFind($obj,'domain/name'))) {loop $xml (xmlFind($obj,'domain/app-deployment')) {if match(xmlData(xmlFind($xml,'name')),'^DMS Application',true) {write '---+ JRF Configuration Information' write '---## Information Taken from ',encode(lastFile()) var $lst = xmlData(xmlFind($xml,'target')) if match($lst,verbatim($srv),true) write " * '**",encode($srv),"**' server is configured with JRF." else {write " * '**",encode($srv),"**' server is not configured with JRF." var $NO_JRF = true } if $NO_JRF write 'Note: Use ``applyJRF`` WLST command to configure JRF.%BR%' toc '2:[[',getFile(),'][rda_report][JRF Configuration]]' break } } } } } =head2 Common Configuration Files Gathers server-wide Oracle WebLogic Server-related configuration files from the F<$DOMAIN_HOME/config/servers> and the F<$DOMAIN_HOME/servers> directory structures. It collects product-specific configuration files on request. =cut # Collect common configuration, product specific details debug ' - Collecting server configuration files' var $dir = catDir($shp) loop $fcs (keys($PLUGIN->{'WLS','srvnodext'})) {if chk_area($fcs,[@fcs]) run &{$PLUGIN->{'WLS','srvnodext',$fcs}}($dir,$dhp,$srv) } loop $fcs (keys($PLUGIN->{'WLS','srvcfg'})) {if chk_area($fcs,[@fcs]) run &{$PLUGIN->{'WLS','srvcfg',$fcs}}(catDir($dhp,'config'),$srv) } loop $cfg ('srvext','srvprd') {loop $fcs (keys($PLUGIN->{'WLS',$cfg})) {if chk_area($fcs,[@fcs]) run &{$PLUGIN->{'WLS',$cfg,$fcs}}($dir,$dhp,$srv) } } unpretoc 2 } # Remove server symbol and restore module prefix call setSymbol('$SH') call setPrefix($PRE) # Restore the WLST environment call restoreContext($bkp) } # Restore the default behavior call switchToc() =head1 HCVE When requested, performs the postinstallation checks. =cut if ${B_HCVE_CHECKS} {loop $oid (listTargets('WH')) {var $tgt = getTarget($oid) next !?$WLS_TOP = testDir('d',$tgt->get_mw_home('.')) next !?$WL_HOME = testDir('d',$tgt->get_wl_home('.')) debug ' Inside WREQ module, executing the postinstallation checks' # Initialize HCVE input values var ${RUN.HCVE.OFM.WLS.T_DOMAINS} = {%TOPOLOGY} var ${RUN.HCVE.OFM.WLS.T_ENV} = {%ENV} var ${RUN.HCVE.OFM.WLS.T_LOGINS} = {%LOGIN} var ${RUN.HCVE.OFM.WLS.T_URLS} = {%URL} # Determine the WebLogic server version if ?$tgt->get_version var $ver = last elsif ?testDir('d',catDir($WLS_TOP,'inventory')) var $ver = 12 elsif ?testDir('d',catDir($WL_HOME,'inventory')) var $ver = 10 if compare('VALID',$ver,12) test TOOL:TLhcve('OFM:Pwls12_gen') elsif compare('VALID',$ver,10) test TOOL:TLhcve('OFM:Pwls10_gen') break } } =head1 SEE ALSO L, L, L, L, L, L, L, L =begin credits =over 10 =item RDA 4.21: Greg Cook, Tony Mitri, Eliane Papillon Le Noc, Andrew Salt, Hector Viveros. =item RDA 4.22: Meraj Mohammed, Maria Salzberger. =item RDA 4.24: Greg Cook, Mark Mayernick, Andrew Salt. =item RDA 4.26: Laurence De Sulzer Wart, Wes Root, Maria Salzberger. =item RDA 4.27: Laurent Goldsztejn. =item RDA 4.28: Richard Bingham, Brad Donison. =item RDA 4.29: Adriana Dominguez, Roelof Van Suilichem. =item RDA 4.30: Prateek Khanna, Laxmi Prasanna Madu, Daniel Mortimer, Sudarshan Subbegowda. =item RDA 4.31: Laxmi Prasanna Madu. =item RDA 8.00: Shawn Bailey, Brad Donison, Laurent Goldsztejn, Daniel Mortimer, Maria Salzberger. =item RDA 8.01: Daniel Mortimer, Wes Root, Maria Salzberger. =item RDA 8.02: Srihari Gaddam, Laxmi Prasanna Madu, Daniel Mortimer, Pedro Nunes, Wes Root, Maria Salzberger. =item RDA 8.03: Daniel Mortimer, Maria Salzberger. =item RDA 8.04: Daniel Mortimer, Wes Root. =item RDA 8.05: Laxmi Prasanna Madu, Daniel Mortimer, Peter Schordan-Yang. =item RDA 8.06: Raju Bhandare, Kai Ellinger, Pierre Lecomte. =item RDA 8.07: Ian Bristow, Rui Du, Kai Ellinger, Meraj Mohammed, Daniel Mortimer, Pedro Nunes, Wes Root. =item RDA 8.08: Steve Andrew, Ingrid Govaerts, Daniel Mortimer, Maria Salzberger. =item RDA 8.09: Pedro Nunes, Andrei Sima. =item RDA 8.10: Laurent Goldsztejn, Ian Reid, Wes Root. =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