# WLSs.def: Collects Oracle WebLogic Server Information (Single Server/Off Line) # $Id: WLSs.def,v 1.23 2009/08/17 11:52:45 mschenke Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/WLSs.def,v 1.23 2009/08/17 11:52:45 mschenke Exp $ # # Change History # 20090818 MSC Fix diagnostic problems heading. =head1 NAME WLSs - Collects Oracle WebLogic Server Information (Single Server/Off Line) =head1 DESCRIPTION This module collects Oracle WebLogic Server-related information for single Server or off-line collections. The following reports can be generated and are regrouped under C: =head1 REPORTS =cut var ($TYPE,$WLST) = @arg echo tput('bold'),' Processing WLS module (',$TYPE,') ...',tput('off') # Initialization import $ORACLE_HOME,$WLST_DIR var $DOMAIN = getSetting('WLS_DOMAIN','') var $INSTANCE = basename(getSetting('WLS_INSTANCE','')) var $LOG_AGE = getSetting('WLS_LOG_AGE',15) var $RPT_DIRECTORY = getSetting('RPT_DIRECTORY','output') var $TIMEOUT = getSetting('WLS_IMAGE_TIMEOUT',30) var $TAIL = getSetting('RDA_TAIL',1000) if !isAbsolute($RPT_DIRECTORY) var $RPT_DIRECTORY = catDir(getSetting('RDA_WORK'),$RPT_DIRECTORY) var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:WebLogic Server (',check($TYPE,'ONE','Single Server','Offline'),')' # Define the internal counter and duplicate file hash var ($CNT,%DUP) = (0) # Map ECM managed server with its component var %ECM # Define the file sorting macro macro sort_results {var ($lvl,$lgt,$pre,$pat,@fil) = @arg import $CNT,$TOP,%DUP keep $CNT,$TOP,%DUP # Filter the file list loop $fil (@fil) {if $pat next !testFile('frT',$fil) next match($fil,'\.(bmp|exe|gif|jar|jpe?g|wav|wbmp)$',true) var $fil{join("\001",dirname($fil),basename($fil))} = $fil } # Generate the reports and related index links var $lst = '' var $det = $lvl incr $det loop $fil (keys(%fil)) {var $fil = $fil{$fil} # Check for a new section var $grp = dirname($fil) if compare('ne',$grp,$lst) {var $lst = $grp toc $lvl,':',encode(cond($pat,replace($grp,quote($pre),$pat),$grp)),' ' } # Create the report associated with the file debug ' Inside sort_results, getting ',$fil var $nam = basename($fil) if missing($DUP{$fil}) {incr $CNT report concat('log',$CNT,'_',$nam) if !$pat {prefix {write '---+ Display of ',encode($nam),' File' write '---## Information Taken from ',encode($fil) } var ($min,$max) = getDataValue($fil) call writeLines($pre,$min,$max) if hasOutput() write $TOP } elsif match($nam,'^USData.xml$',true) {write '---+ Display of ',encode($nam),' File' write '---## Information Taken from ',encode($fil) call statFile('b',$fil) write '**File was not collected, because of the file size.**%BR%' } elsif match($fil,'(logs?[\/\\]|log$)',true) {if exists($LOG{$fil}) var $cnt = $LOG{$fil} else var $cnt = $lgt if $cnt write '---+ Last ',$cnt,' Lines of ',encode($nam),' File' else write '---+ Display of ',encode($nam),' File' write '---## Information Taken from ',encode($fil) call statFile('b',$fil) if $cnt call writeTail($fil,$cnt) else call writeFile($fil) write $TOP } else {write '---+ Display of ',encode($nam),' File' write '---## Information Taken from ',encode($fil) call statFile('b',$fil) call writeFile($fil) write $TOP } var $rpt = getFile() if $pat var $DUP{$fil} = $rpt } if isCreated(true) toc $det,':[[',$rpt,'][rda_report][',encode($nam),']]' } } # Parse the output from WLST macro write_report {var ($out) = @arg var $lvl = nvl($arg[1],0) import $TOC,$TOP,%ECM keep $TOC,$TOP if createBuffer('OUT','R',$out) {var $rew = '' loop $lin (grepBuffer('OUT','^\-{3}#\s+RDA:(BEGIN|END)','n')) {var ($num,undef,$cmd,$dat) = split(':',$lin,4) if compare('eq',$cmd,'BEGIN') var $beg = $num elsif compare('eq',$cmd,'BEGIN SECTION') {incr $lvl call clearData() pretoc $dat } elsif compare('eq',$cmd,'BEGIN TITLE') {var $lvl = 0 toc $dat } elsif compare('eq',$cmd,'END FILE') {incr $beg decr $num if expr('>=',$num,$beg) {call addDataValue($dat,$beg) call addDataValue($dat,$num) } } elsif compare('eq',$cmd,'END REPORT') {var ($det,$lnk,$ttl,$loc,$rep) = split('\|',$dat,5) report nvl(replace($rep,'[\/\\]','r',true),$lnk) prefix {write '---+!! ',$ttl if $loc write '---## Location: ',encode($loc) } incr $beg decr $num call writeLines($out,$beg,$num) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][',$lnk,']]' } } elsif compare('eq',$cmd,'END TABLE') {var ($det,$lnk,$ttl,$loc,$rep,$com) = split('\|',$dat,6) var ($nxt,$sct,$skp) = (false,false,false) incr $beg decr $num report nvl(replace($rep,'[\/\\]','r',true),$lnk) prefix {write '---+!! ',$ttl if $loc write '---## Location: ',encode($loc) write $TOC } loop $str (grepBuffer('OUT','.*',$rew,undef,$beg,$num)) {if match($str,'^\-+$') {if $nxt {write ' |' var $nxt = false } if $skp var $skp = false elsif $sct {write $TOP var $sct = false } } elsif match($str,'^d[rwx\-]+\s+') {if !isCreated() write '---++ Overview' if !$sct {write '---+++ Child Beans' write '|*Property*|*Name*|' } write '|',replace(replace($str,'\*','*',true),'\s+',' |',true),' |' var $sct = true } elsif match($str,'^\-[rw\-]{2}x',true) {if !isCreated() write '---++ Overview' if !$sct {write '---+++ Operations' write '|*Property*|*Name*|*Value*|' } var ($mod,$tmp) = split('\s{3,}',$str,2) var ($nam,$val) = split('\s+',$tmp,2) write '|',$mod,' |',$nam,' |',replace($val,'\*','*',true),' |' var $sct = true } elsif match($str,'^\-') {if !isCreated() write '---++ Overview' if !$sct {write '---+++ Attributes' write '|*Property*|*Name*|*Value*|' } var ($mod,$tmp) = split('\s{3,}',$str,2) var ($nam,$val) = split('\s+',$tmp,2) if match($val,'^WebLogic Server Temporary Patch') {write '|',$mod,' |',$nam,' |',replace($val,'\*','*',true),'\' var $nxt = true } else write '|',$mod,' |',$nam,' |',replace($val,'\*','*',true),' |' var $sct = true } elsif match($str,'^Attribute Names and Values$') {write '---++ ',$str write '|*Name*|*Value*|' var ($sct,$skp) = (true,true) } elsif match($str,'^Operations on this MBean$') {write '---++ ',$str write '|*Operation*|' var ($sct,$skp) = (true,true) } elsif match($str,'^(ThreadStackDump|\ WeblogicVersion\s+WebLogic Server Temporary Patch)') {write '|',\ replace(replace($str,'\*','*',true),'\s{3,}',' |',true),'\' var $nxt = true } elsif $nxt {if match($str,'^(OSVersion|Parent|TotalHeap)') {write ' |' write '|',replace(replace(\ $str,'\*','*',true),'\s{3,}',' |',true),' |' var $nxt = false } elsif match($str,'^WebLogic Server\s+\d') {write '%BR%',$str,' |' var $nxt = false } else write '%BR%',$str,'\' } elsif $com {if match($str,'^Domain Properties$') {write '---++ ',$str write '|*Property*|*Value*|' var $sct = true } elsif match($str,'^\w+$') {write '---++ ',$str var $dft = '|*Property*|*Value*|' var $sct = true } elsif match($str,'^.*?\s+\|.*?\s+\|.*?\s*$') {var $hdr = '|*Name*|*Status*| *Priority*|' write $hdr } elsif match($str,'^\s*$') {if isCreated() write $TOP var $sct = false } elsif $hdr {var ($nam,$sta,$pri) = split('\s{1,}',replace($str,'\*','*',true),3) write '|',$nam,' |',$sta,' | ',$pri,'|' } else {if $dft {write $dft var $dft = undef } var ($prp,$val) = split('\s{1,}',replace($str,'\*','*',true),2) write '|',$prp,' |',$val,' |' } } elsif match($str,'^\s*$') {if $sct {write $TOP var $sct = false } } else write '|',\ replace(replace($str,'\*','*',true),'\s{3,}',' |',true),' |' } var $rew = 'r' if $sct write $TOP if isCreated(true) toc $det,':[[',getFile(),'][rda_report][',$lnk,']]' } elsif compare('eq',$cmd,'END SECTION') {if $dat call sort_results($dat,0,$out,false,getDataKeys()) call clearData() if $lvl {unpretoc decr $lvl } } elsif compare('eq',$cmd,'END VARIABLE') {incr $beg decr $num loop $pat (grepBuffer('OUT','.*','r',undef,$beg,$num)) {if match($pat,'^.+?=.+$') var $ECM{key($pat)} = value($pat) } } } call deleteBuffer('OUT') } } # Check the connection to the WLS var ($wls,$WLS_TOP) = (false,'') if testFile('fr',catFile($DOMAIN,'config','config.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) if match(xmlData(xmlFind($obj,'domain/name')),quote(basename($DOMAIN)),true) {var $ADMIN = xmlData(xmlFind($obj,'domain/admin-server-name')) loop $xml (xmlFind($obj,'domain/server')) {if compare('eq',xmlData(xmlFind($xml,'name')),$ADMIN) {var $hst = xmlData(xmlFind($xml,'listen-address')) var $prt = xmlData(xmlFind($xml,'listen-port')) var $ssl = 0 if xmlFind($xml,'ssl') {var ($nod) = last if match(xmlData(xmlFind($nod,'enabled')),'true',true) var $ssl = nvl(xmlData(xmlFind($nod,'listen-port')),7002) } break } } } } while loadFile(catFile($DOMAIN,'init-info','tokenValue.properties')) {# Get the BEA_HOME directory if value(grepLastFile('^[^#]*BEA_HOME','f')) var $WLS_TOP = catDir(replace(last,'\\:',':')) # Determine how to connect if $WLST {var $shl = cond(isWindows(),catCommand($WLST_DIR,'bin','wlst.cmd'),\ catCommand($WLST_DIR,'bin','wlst.sh')) if compare('eq',$TYPE,'ONE') {# Validate the configuration settings if !length($hst) {var $hst = value(grepLastFile('^[^#]*SERVER_HOST','f')) if !length($hst) {echo 'Missing host for a Oracle WebLogic Server connection' break } } if !match($hst,'^[\w\-\.]+$') {echo 'Invalid Oracle WebLogic Server host' break } if !match($prt,'^\d+$') {var $prt = value(grepLastFile('^[^#]*SERVER_PORT','f')) if !match($prt,'^\d+$') var $prt = 7001 } var @url = (concat($hst,':',$prt)) if $ssl var @url = (concat('t3s://',$hst,':',$ssl),@url) if !length($ADMIN) var $ADMIN = value(grepLastFile('^[^#]*SERVER_NAME','f')) var $usr = getSetting('WLS_USER','') if !length($usr) var $usr = value(grepLastFile('^[^#]*DOMAIN_USER','f')) if !match($usr,'^\w+$') {echo 'Invalid or missing Oracle WebLogic Server user' break } if getSetting('SQL_PASSWORD_WLS_USER') var ($pwd) = unpack('u',last) else var $pwd = askPassword(concat('Enter ',$usr,' user password:')) # Check the WLST connection report wls_error loop $url (@url) {var $job = createTemp('job','.py') var $out = getTemp('out') var $err = getTemp('err') var $con = concat('connect("',$usr,'","',$pwd,'","',$url,'")') call writeTemp('job',$con) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'),\ " 2>",quote($err,'x'))) if grepFile($out,'Successfully connected ','f') var $wls = true else {write '**Error encountered when connecting to the Oracle WebLogic \ Server using: ',$url,'**' write if testFile('s',$err) call writeFile($err) else call writeFile($out) } call unlinkTemp('job') call unlinkTemp('out') call unlinkTemp('err') break $wls } if !$wls {echo 'Error encountered when connecting to the Oracle WebLogic Server' toc '2:[[',getFile(),\ '][rda_report][Oracle WebLogic Server Connection Error]]' } } } break } =head2 Clusters Collects domain-wide cluster management objects information (such as number of C managed under the cluster). It does not collect those information in offline collections. =cut if $wls {debug ' Inside WLSs module, gathering cluster information' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {def getClusterNames(): " domainConfig() " return cmo.getClusters() " "def extractWlsCluster(clu): " cd(clu) " print "---# RDA:BEGIN SECTION:3:'" + clu + "' Cluster" " print '---# RDA:BEGIN' " ls() " print "---# RDA:END TABLE:4|Attributes|'"+clu+"' Topology \ Information|"+pwd()+'|clu_attr_'+clu " print '---# RDA:BEGIN' " state(clu,'Cluster') " print "---# RDA:END REPORT:4|Status|'"+clu+"' Status \ Information|"+pwd()+'|clu_sta_'+clu " print '---# RDA:BEGIN' " viewMBean(cmo) " print "---# RDA:END TABLE:4|MBean|'"+clu+"' Configuration \ Information|"+pwd()+'|clu_bean_'+clu " cd('Servers') " print '---# RDA:BEGIN' " ls() " print "---# RDA:END TABLE:4|Servers|'"+clu+"' Managed Servers \ Information|"+pwd()+'|clu_svr_'+clu " cd('..') " print '---# RDA:END SECTION' " cd('..') " "clusterNames = getClusterNames() "cd('Clusters') "print '---# RDA:BEGIN SECTION:2:Clusters' "for nam in clusterNames: " extractWlsCluster(nam.getName()) " "print '---# RDA:END SECTION' "cd('..') " } call writeTemp('job',$con) call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') =head2 Domain Configuration Collects domain-wide configuration management objects information (such as C, C, C, C, C, C, and C). It does not collect those information in offline collections. =cut debug ' Inside WLSs module, gathering domain configuration information' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {def getConfigData(dir,ins,ttl,rpt): " try: " cd(dir) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print '---# RDA:END TABLE:6|'+ttl+"|'"+ins+"' "+ttl+' Configuration \ Information|'+pwd()+'|'+rpt+'_'+ins " cd('..') " except WLSTException,e: " pass " "def extractWlsIns(ins): " cd(ins) " print '---# RDA SERVER PORT=' + ins + ':' + str(get('ListenPort')) " print "---# RDA:BEGIN SECTION:4:'" + ins + "' Server" " print '---# RDA:BEGIN' " ls() " print "---# RDA:END TABLE:5|Attributes|'"+ins+"' Topology \ Information|"+pwd()+'|ins_attr_'+ins " print '---# RDA:BEGIN' " state(ins,'Server') " print "---# RDA:END REPORT:5|Status|'"+ins+"' Status \ Information|"+pwd()+'|ins_sta_'+ins " print '---# RDA:BEGIN' " viewMBean(cmo) " print "---# RDA:END TABLE:5|MBean|'"+ins+"' Configuration \ Information|"+pwd()+'|ins_bean_'+ins " cd("Log/"+ins) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END TABLE:5|Server Log|'"+ins+"' Log Configuration \ Information|"+pwd()+'|svr_log_'+ins " getConfigData('LogFileFilter',ins,'Log File Filter','log_fil_filter') " getConfigData('MemoryBufferFilter',ins,'Memory Buffer Filter',\ 'mem_buf_filter') " getConfigData('StdoutFilter',ins,'Stdout Filter','std_out_filter') " cd('../..') " cd("WebServer/"+ins) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END TABLE:5|Web Server|'"+ins+"' Web Server \ Configuration Information|"+pwd()+'|web_svr_'+ins " getConfigData("WebServerLog/"+ins,ins,'Web Server Log','web_svr_log') " cd('../../..') " print '---# RDA:END SECTION' " cd('..') " "domainConfig() "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:2|Domain Configuration|Domain Configuration \ Information|'+pwd()+'|dom_config' "ecm={} "cd('AppDeployments') "for app in "content","imaging","irm","Oracle Content Server": " try: " cd(app+'/Targets') " for trg in ls('c',returnMap='true'): " ecm[trg]=app " cd('../..') " except: " pass " "cd('..') "if len(ecm): " print '---# RDA:BEGIN' " for key,val in ecm.iteritems(): " print key+'='+val " print '---# RDA:END VARIABLE' "print '---# RDA:BEGIN SECTION:3:Server Configuration' "cd('Servers') "extractWlsIns(ins) "print '---# RDA:END SECTION' "cd('..') "cd('Log') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|Domain Log Configuration|Domain Log \ Configuration Information|'+pwd()+'|log_config' "cd('..') "cd('LogFilters') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|Log Filters Configuration|Domain Log \ Filters Configuration Information|'+pwd()+'|log_filter_config' "cd('..') "cd('VirtualHosts') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|Virtual Hosts Configuration|Domain \ Virtual Hosts Configuration Information|'+pwd()+'|virt_hst_config' "cd('..') "cd('JDBCSystemResources') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|JDBC System Resources Configuration|\ Domain JDBC System Resources Configuration Information|'+pwd()+'|\ jdbc_config' "cd('..') "cd('JMSServers') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|JMS Servers Configuration|Domain JMS \ Servers Configuration Information|'+pwd()+'|jms_svr_config' "cd('..') "cd('JMSSystemResources') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|JMS System Resources Configuration|Domain \ JMS System Resources Configuration Information|'+pwd()+'|jms_sys_config' "cd('..') " } call writeTemp('job',$con) call writeTemp('job','ins="',$INSTANCE,'"') call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) var %srv = () if grepFile($out,'^\-{3}#\s+RDA SERVER PORT') {var ($str) = (last) var ($srv,$prt) = split(':',value($str),2) var $srv{$srv} = $prt } call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') } =head2 Enterprise Content Management Collects Enterprise Content Management related configuration management objects information. =cut if and($wls,%ECM) {debug ' Inside WLSs module, gathering ECM related information' pretoc '2:Enterprise Content Management' loop $srv (keys(%ECM)) {next !compare('eq',$srv,$INSTANCE) # Collect Universal Online Archive (UOA) related MBeans if compare('eq',$ECM{$srv},'content') {pretoc '3:Universal Online Archive' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {custom() "print '---# RDA:BEGIN' "getUOADomain() "print '---# RDA:END TABLE:4|Domain Configuration|Oracle UOA Domain \ Configuration Information|'+pwd()+'|uoa_dom_config|1' "print '---# RDA:BEGIN' "getUOANode() "print '---# RDA:END TABLE:4|Node Configuration|Oracle UOA Node \ Configuration Information|'+pwd()+'|uoa_node_config|1' "print '---# RDA:BEGIN' "getUOAServer() "print '---# RDA:END TABLE:4|Server Configuration|Oracle UOA Server \ Configuration Information|'+pwd()+'|uoa_server_config|1' "print '---# RDA:BEGIN' "getUOAService() "print '---# RDA:END TABLE:4|Service Configuration|Oracle UOA Service \ Configuration Information|'+pwd()+'|uoa_service_config|1' "print '---# RDA:BEGIN' "listUOAServers() "print '---# RDA:END TABLE:4|Servers|Oracle UOA Servers Information|'+\ pwd()+'|uoa_servers|1' } call writeTemp('job',concat('connect("',$usr,'","',$pwd,'","',$hst,':',\ $srv{$INSTANCE},'")')) call writeTemp('job','ins="',$INSTANCE,'"') call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') unpretoc } # Collect Universal Content Management (UCM) related MBeans if compare('eq',$ECM{$srv},'Oracle Content Server') {pretoc '3:Universal Content Management' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {print '---# RDA:BEGIN' "getUCMCSVersion() "print '---# RDA:END REPORT:4|Version|Oracle UCM Content Server Version \ Information|'+pwd()+'|ucm_version' "print '---# RDA:BEGIN' "getUCMHttpServerAddress() "print '---# RDA:END REPORT:4|HTTP Server Address|Oracle UCM HTTP Server \ Address Information|'+pwd()+'|ucm_http_ser_ver' "print '---# RDA:BEGIN' "getUCMIpAddressFilter() "print '---# RDA:END REPORT:4|IP Address Filter|Oracle UCM IP Address \ Filter Information|'+pwd()+'|ucm_ip_addr_fil' "print '---# RDA:BEGIN' "getUCMMailServer() "print '---# RDA:END REPORT:4|Mail Server|Oracle UCM Mail Server \ Information|'+pwd()+'|ucm_mail_ser' "print '---# RDA:BEGIN' "getUCMServerPort() "print '---# RDA:END REPORT:4|Server Port|Oracle UCM Server Port \ Information|'+pwd()+'|ucm_ser_prt' "print '---# RDA:BEGIN' "getUCMServerUptime() "print '---# RDA:END REPORT:4|Server Uptime|Oracle UCM Server Uptime \ Information|'+pwd()+'|ucm_ser_upt' "print '---# RDA:BEGIN' "getUCMSmtpPort() "print '---# RDA:END REPORT:4|SMTP Port|Oracle UCM SMTP Port \ Information|'+pwd()+'|ucm_smtp_prt' "print '---# RDA:BEGIN' "getUCMSysAdminAddress() "print '---# RDA:END REPORT:4|SysAdmin Address|Oracle UCM SysAdmin Address \ Information|'+pwd()+'|ucm_sysadm_addr' } call writeTemp('job',concat('connect("',$usr,'","',$pwd,'","',$hst,':',\ $srv{$INSTANCE},'")')) call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') unpretoc } # Collect Information Rights Management (IRM) related MBeans if compare('eq',$ECM{$srv},'irm') {pretoc '3:Information Rights Management' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {custom() "print '---# RDA:BEGIN' "getIRMJournalCleanUp() "print '---# RDA:END REPORT:4|Journal Clean Up|Oracle IRM Journal Clean Up \ Information|'+pwd()+'|irm_jrnl_clnup' "print '---# RDA:BEGIN' "getIRMLicenseStateCleanUp() "print '---# RDA:END REPORT:4|License State Clean Up|Oracle IRM License \ State Clean Up Information|'+pwd()+'|irm_lic_sta_clnup' "print '---# RDA:BEGIN' "getIRMRefreshPeriods() "print '---# RDA:END REPORT:4|Refresh Periods|Oracle IRM Refresh Periods \ Information|'+pwd()+'|irm_ref_per' "print '---# RDA:BEGIN' "getIRMTranslations() "print '---# RDA:END REPORT:4|Translations|Oracle IRM Translations \ Information|'+pwd()+'|irm_trns' } call writeTemp('job',concat('connect("',$usr,'","',$pwd,'","',$hst,':',\ $srv{$INSTANCE},'")')) call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') unpretoc } } unpretoc } =head2 Startup Scripts Gathers Oracle WebLogic Server-related startup scripts. =cut if $DOMAIN {debug ' Inside WLSs module, collecting the startup scripts' pretoc '2:Startup Scripts' call sort_results(3,0,$WLS_TOP,'$TOP',\ grepDir(catDir($DOMAIN,'bin'),'.','p')) unpretoc } =head2 WLST Startup Scripts Gathers Oracle WebLogic Scripting Tool-related startup scripts. =cut debug ' Inside WLSs module, collecting the WLST startup scripts' pretoc '2:WLST Startup Scripts' call sort_results(3,0,$WLS_TOP,'$TOP',grepDir(catDir($WLST_DIR,'bin'),'.','p')) unpretoc =head2 wlst_cmd_list - WLST Command Files List Lists Oracle WebLogic Scripting Tool-related command files. =cut debug ' Inside WLSs 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 Configuration Files Gathers domain-wide Oracle WebLogic Server-related configuration files. =cut debug ' Inside WLSs module, collecting the configuration files' pretoc '2:Configuration Files' if $DOMAIN {# Get the configuration files macro get_config {var (\@tbl,$dir,$pat,$flg) = @arg # Analyze the directory loop $fil (grepDir($dir,'^\.+$','vn')) {next match($fil,concat('^',$pat,'$'),true) var $pth = catFile($dir,$fil) if testDir('d',$pth) var @sub = (@sub,$pth) elsif $flg var @tbl = (@tbl,$pth) elsif match($pth,'\.(properties|xml)$',true) var @tbl = (@tbl,$pth) } # Treat the sub directories loop $sub (@sub) call get_config(\@tbl,$sub,'servers',$flg) } var @tbl = () call get_config(\@tbl,catDir($DOMAIN),'config|servers|ucm',false) call get_config(\@tbl,catDir($DOMAIN,'config'),'servers',true) var @tbl = (@tbl,\ grepDir(catDir($DOMAIN,'servers',$INSTANCE),'\.(properties|xml)$','dir'),\ grepDir(catDir($DOMAIN,'config','fmwconfig','servers',$INSTANCE),\ '^\.+$','drv'),\ grepDir(catDir($DOMAIN,'config','oracle','servers',$INSTANCE),\ '^\.+$','drv')) var $dir = catDir($DOMAIN,'servers',$INSTANCE,'stage','OIF') loop $nam (grepDir($dir,'^\d+(\.\d+){4}$')) var @tbl = (@tbl,grepDir(catDir($dir,$nam,'OIF','web.war'),'\.jsp$','ip')) } else var @tbl = () if grepDir($WLS_TOP,'^wlserver_\d+') {var $NMG = \ catFile($WLS_TOP,last,'common','nodemanager','nodemanager.properties') var @tbl = (@tbl,$NMG) } call sort_results(3,0,$WLS_TOP,'$TOP',catFile($WLS_TOP,'license.bea'),\ catFile($WLS_TOP,'registry.xml'),\ @tbl) unpretoc =head2 JRF Configuration Gathers Java Required Files (JRF)-related configuration information. =cut debug ' Inside WLSs module, checking JRF configuration' report jrf_config prefix {write '---+!! JRF Configuration Information' write $TOC } if testFile('fr',catFile($DOMAIN,'config','config.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) if match(xmlData(xmlFind($obj,'domain/name')),quote(basename($DOMAIN)),true) {loop $xml (xmlFind($obj,'domain/app-deployment')) {if match(xmlData(xmlFind($xml,'name')),'^DMS Application',true) {write '---++ Server Configuration' write '---## Information Taken from ',encode(lastFile()) if match(xmlData(xmlFind($xml,'target')),quote($INSTANCE),true) write " * '**",$INSTANCE,"**' server is configured with JRF." else {write " * '**",$INSTANCE,"**' server is not configured with JRF." write 'Note: Use ``applyJRF`` WLST command to configure JRF.%BR%' } write $TOP break } } } } if testFile('fr',$NMG) {write '---++ Nodemanager Configuration' write '---## Information Taken from ',encode($NMG) if match(value(grepFile($NMG,'^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%' } write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][JRF Configuration]]' =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 WLSs 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,'^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 WLSs 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 Patch Information Displays the patches found in the server log files since the last startup. It lists the server logs also. =cut macro search_patches {var (\$beg,\$cls,\$lib,\$ver,\%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,$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 parseVar($lin) call parsePattern('TOP',\ 'Temporary Patch for [Cc][Rr]\d{6,}',\ add_patch(\%cur,$lin),\ '^#{4}<(.*?)>.*?, C, C, C, C, C, and C). =cut var $AS11 = false if grepDir(catDir($WLST_DIR,'wlst'),'^(oracledms|oracle-logging)\.py$','if') var $AS11 = true if $wls {debug ' Inside WLSs module, gathering domain runtime information' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {domainRuntime() "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:2|Domain Runtime|Domain Runtime \ Information|'+pwd()+'|dom_runtime' "print '---# RDA:BEGIN SECTION:3:Server Runtime' "cd("/ServerRuntimes/"+ins) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END TABLE:4|'"+ins+"' Server|'"+ins+"' Server Runtime \ Information|"+pwd()+'|svr_runtime' "cd("/ServerRuntimes/"+ins+"/ClusterRuntime") "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END TABLE:5|Cluster Runtime|'"+ins+"' Cluster Runtime \ Information|"+pwd()+'|svr_clu_runtime' "cd("/ServerRuntimes/"+ins+"/JDBCServiceRuntime/"+ins) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END TABLE:5|JDBC Service Runtime|'"+ins+"' JDBC \ Service Runtime Information|"+pwd()+'|svr_jdbc_runtime' "cd("/ServerRuntimes/"+ins+"/JMSRuntime/"+ins+".jms") "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END TABLE:5|JMS Runtime|'"+ins+"' JMS Runtime \ Information|"+pwd()+'|svr_jms_runtime' "cd("/ServerRuntimes/"+ins+"/JVMRuntime/"+ins) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END TABLE:5|JVM Runtime|'"+ins+"' JVM Runtime \ Information|"+pwd()+'|svr_jvm_runtime' "cd("/ServerRuntimes/"+ins+"/LogRuntime/"+ins) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END TABLE:5|Server Log Runtime|'"+ins+"' Log Runtime \ Information|"+pwd()+'|svr_log_runtime' "cd("/ServerRuntimes/"+ins) "if AS11 == 1: " print '---# RDA:BEGIN SECTION:5:Log Queries' " print '---# RDA:BEGIN' " displayLogs(target=ins,last=1440,\ groupBy=['COMPONENT_ID','MODULE_ID','MSG_TYPE']) " print "---# RDA:END REPORT:6|Activities over last 24 Hours|'"+ins+\ "' Activities over last 24 Hours|"+pwd()+'|odl_24h_'+ins " tb_cid = displayLogs(target=ins,last=1440,groupBy="COMPONENT_ID",\ returnData=1) " for cid in tb_cid.keySet(): " try: " qry = 'COMPONENT_ID equals '+cid+\ ' and MSG_TYPE equals ERROR or MSG_TYPE equals WARNING' " print '---# RDA:BEGIN' " displayLogs(tail=TAIL,query=qry) " print '---# RDA:END REPORT:6|Last Warnings and Errors for '+cid+"|'"+\ ins+"' Last Warnings and Errors for "+cid+'|'+pwd()+'|odl_com_'+\ ins+'_'+cid " except: " pass " " print '---# RDA:END SECTION' " print '---# RDA:BEGIN' " dumpMetrics(format="raw",servers=(ins)) " print "---# RDA:END REPORT:5|dumpMetrics|'"+ins+"' DMS Dump Metrics|"+\ pwd()+'|svr_dump_metrics_'+ins " "print '---# RDA:END SECTION' "cd('/LogRuntime/'+domainName) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|Domain Log Runtime|Domain Log Runtime \ Information|'+pwd()+'|log_runtime' "cd('/DomainServices') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END TABLE:3|Domain Services|Domain Services Runtime \ Information|'+pwd()+'|dom_service' "cd('..') "if AS11 == 1: " print '---# RDA:BEGIN SECTION:3:Log Queries' " print '---# RDA:BEGIN' " displayLogs(last=1440,groupBy=['COMPONENT_ID','MODULE_ID','MSG_TYPE']) " print '---# RDA:END REPORT:4|Activities over last 24 Hours|\ Domain Activities over last 24 Hours|'+pwd()+'|dom_odl_24h' " tb_cid = displayLogs(last=1440,groupBy="COMPONENT_ID",returnData=1) " for cid in tb_cid.keySet(): " try: " qry = 'COMPONENT_ID equals '+cid+\ ' and MSG_TYPE equals ERROR or MSG_TYPE equals WARNING' " print '---# RDA:BEGIN' " displayLogs(tail=TAIL,query=qry) " print '---# RDA:END REPORT:4|Last Warnings and Errors for '+cid+'|Domain \ Last Warnings and Errors for '+cid+'|'+pwd()+'|dom_odl_com_'+cid " except: " pass " " print '---# RDA:END SECTION' " print '---# RDA:BEGIN' " dumpMetrics(format="raw") " print '---# RDA:END REPORT:3|dumpMetrics|Domain DMS Dump Metrics|'+\ pwd()+'|dom_dump_metrics' " " } call writeTemp('job',$con) call writeTemp('job','AS11=',$AS11) call writeTemp('job','ins="',$INSTANCE,'"') call writeTemp('job','TAIL=',$TAIL) call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') } elsif and($AS11,$WLST,compare('eq',$TYPE,'OFF')) {debug ' Inside WLSs module, gathering log queries' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {print '---# RDA:BEGIN SECTION:2:Log Queries' "print '---# RDA:BEGIN' "displayLogs(target=ins,last=1440,\ groupBy=['COMPONENT_ID','MODULE_ID','MSG_TYPE']) "print '---# RDA:END REPORT:3|Activities over last 24 Hours|\ Activities over last 24 Hours||odl_24h' "tb_cid = displayLogs(target=ins,last=1440,groupBy="COMPONENT_ID",returnData=1) "for cid in tb_cid.keySet(): " try: " qry = 'COMPONENT_ID equals '+cid+\ ' and MSG_TYPE equals ERROR or MSG_TYPE equals WARNING' " print '---# RDA:BEGIN' " displayLogs(tail=TAIL,query=qry) " print '---# RDA:END REPORT:3|Last Warnings and Errors for '+cid+'|\ Last Warnings and Errors for '+cid+'||odl_com_'+cid " except: " pass " "print '---# RDA:END SECTION' " } call writeTemp('job','ins="',$INSTANCE,'"') call writeTemp('job','TAIL=',$TAIL) call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call write_report($out,true) call unlinkTemp('job') call unlinkTemp('out') } =head2 diag_image - Diagnostic Image You use the Diagnostic Image Capture component of the Oracle WebLogic Diagnostic Framework (WLDF) to create a diagnostic snapshot, or dump, of a server's internal runtime state at the time of the capture. It requires the availability of Oracle WebLogic Scripting Tool (WLST). =cut if $wls {debug ' Inside WLSs module, capturing server diagnostic image' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') set $cod {timeout=0 "serverRuntime() "cd('WLDFRuntime/WLDFRuntime/WLDFImageRuntime/Image') "argTypes = jarray.array(['java.lang.String','java.lang.Integer'],\ java.lang.String) "argValues = jarray.array([rpt,timeout],java.lang.Object) "invoke('captureImage', argValues, argTypes) " } call writeTemp('job',concat('connect("',$usr,'","',$pwd,'","',$hst,':',\ $srv{$INSTANCE},'")')) var $tgt = join('/',splitDir($RPT_DIRECTORY)) call writeTemp('job','rpt="',$tgt,'"') call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call unlinkTemp('job') call unlinkTemp('out') if grepDir($RPT_DIRECTORY,\ concat('^diagnostic_image_',$INSTANCE,\ '_\d{4}_\d{2}_\d{2}_\d{2}_\d{2}_\d{2}\.zip$'),\ 'it') {var ($nam) = (last) data $nam var ($tim,$img) = ($TIMEOUT,getFile('.')) while expr('>',$tim,0) {sleep 5 if transfer($RPT_DIRECTORY,$nam,$RPT_DIRECTORY,$img) {report diag_image write '---+ Diagnostic Image Data' write '|*Image Name*|' write '|[[',$img,'][_blank][',$nam,']]|' write ' * Links point to files that have been collected in their \ original format. Opening them directly in your browser can \ present security risks. To prevent them, access the file \ outside the browser or use the link to save them and use an \ adequate viewer.' toc '2:[[',getFile(),'][rda_report][Diagnostic Image]]' break } decr $tim,5 } } } =head2 Diagnostic Repository Automatic Diagnostic Repository (ADR) is a file-based repository for Application Server diagnostic data. The ADR Command Interpreter (ADRCI) is a command-line tool that you use to view diagnostic data within the Automatic Diagnostic Repository. Diagnostic data includes incident and problem descriptions. =cut =head3 diag_problems - 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. It requires the availability of the ADRCI utility. =cut var $cmd = undef if getSetting('ADRCI_PATH') var $cmd = catCommand(last) elsif findCommand('adrci') var $cmd = last elsif grepDir(catDir($ORACLE_HOME,'bin'),'^adrci(\.exe)?$','fip') var $cmd = catCommand(last) elsif grepDir($ORACLE_HOME,'^adrci(\.exe)?$','fip') var $cmd = catCommand(last) elsif grepDir($WLS_TOP,'^\.+$','vn') {loop $nam (last) {next match($nam,concat(\ '^(jdk|jrockit|logs|modules|registry|user_projects|utils|wlserver|',\ quote(basename($ORACLE_HOME)),')'),true) if grepDir(catDir($WLS_TOP,$nam),'^adrci(\.exe)?$','fir') {var $cmd = catCommand(last) break } } } if $cmd {debug ' Inside WLSs module, collecting diagnostic repository' var $bas = catDir($DOMAIN,'servers',$INSTANCE,'adr') var $hom = catDir('diag','ofm',basename($DOMAIN),$INSTANCE) 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=',quote($job,'x'),\ ' >',quote($out,'x'),' 2>',quote($err,'x'))) pretoc '2:Diagnostic Repository' report diag_problems if testFile('z',$out) {echo 'Error encountered with ADRCI' write '** Error encountered with ADRCI **' write call writeFile($err) } elsif createBuffer('ADR','R',$out) {var ($cnt,$min,$cut,$src,$hdr) = (0,0,true) prefix {write '---+ 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 '3:[[',getFile(),'][rda_report][Problem Overview]]' =head3 diag_incidents - Most Recent Incidents Gathers diagnostic incidents. An incident is a single occurrence of a problem. When a problem (critical error) occurs multiple times, an incident is created for each occurrence. Incidents are time stamped and tracked in the Automatic Diagnostic Repository. By default, RDA will collect the last 10 incidents. It requires the availability of the ADRCI utility. =cut var $MAX = getSetting('WLS_INCIDENTS',10) 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=',quote($job,'x'),' >',quote($out,'x'))) 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*$') var @inc = (@inc,last) elsif match($lin,'^\d+\s+rows\s+fetched$') break } call deleteBuffer('ADR') } # Get the incident details 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=',quote($job,'x'),' >',quote($out,'x'))) if createBuffer('ADR','R',$out) {report concat('incident_',$inc) var ($cut,$src) = (true) prefix {write '---+ 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,' |' } elsif match($lin,'^\d+\s+rows\s+fetched$') break } if isCreated(true) {write $TOP var $lnk{$inc} = getFile() } call deleteBuffer('ADR') } call unlinkTemp('job') call unlinkTemp('out') # Limit the incident number decr $max break !$max } report diag_incidents prefix {write '---+ Display of Last ',$MAX,' Incidents' write '| *Incident ID*|' } loop $inc (@inc) {if exists($lnk{$inc}) write '| [[',$lnk{$inc},'][_blank][',$inc,']]|' } if isCreated(true) toc '3:[[',getFile(),'][rda_report][Most Recent Incidents]]' } unpretoc } =head2 log_info - 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. This is done using C in connected mode and C in offline mode. The C collects data with the default options. It requires the availability of Oracle WebLogic Scripting Tool (WLST). =cut if $WLST {debug ' Inside WLSs module, collecting log information' var $job = createTemp('job','.py') var $out = getTemp('out','.txt') var ($fil,@tbl,%log) = () var @tbl = ('EventsDataArchive','HarvestedDataArchive','ServerLog') if compare('eq',$TYPE,'ONE') {if exists($srv{$ADMIN}) var @tbl = (@tbl,'DomainLog') } else var @tbl = (@tbl,'ConnectorLog','DomainLog','JMSMessageLog','WebAppLog') loop $nam (@tbl) {data $nam var $log{$nam} = getFile('/') } loop $log (keys(%log)) var $fil = join(',',$fil,\ concat("'",replace($log{$log},'\\','/',true),"':'",$log,"'")) var $end = time() var $beg = expr('-',$end,expr('*',$LOG_AGE,86400)) if $wls {set $cod {for pth in fil.keys(): " try: " exportDiagnosticDataFromServer(logicalName=fil[pth],exportFileName=pth,\ beginTimestamp=beg,endTimestamp=end) " except WLSTException,e: " pass " } var $cmd = 'exportDiagnosticDataFromServer' call writeTemp('job',concat('connect("',$usr,'","',$pwd,'","',$hst,':',\ $srv{$INSTANCE},'")')) call writeTemp('job','beg=',concat($beg,'000L')) call writeTemp('job','end=',concat($end,'000L')) } else {set $cod {for pth in fil.keys(): " try: " exportDiagnosticData(logicalName=fil[pth],exportFileName=pth) " except WLSTException,e: " pass " } var $cmd = 'exportDiagnosticData' } call writeTemp('job','fil={',$fil,'}') call writeTemp('job',$cod) call writeTemp('job','exit()') call closeTemp('job') call command(concat($shl," ",quote($job,'x')," >",quote($out,'x'))) call unlinkTemp('job') call unlinkTemp('out') report log_info prefix {write '---+ Log Exports' write '---## Using: ',$cmd write '|*Exported Data*|' } loop $log (keys(%log)) write '|[[',basename($log{$log}),'][_blank][',$log,']]|' if isCreated(true) {write ' * Links point to files that have been collected in their original \ format. Opening them directly in your browser can present \ security risks. To prevent them, access the file outside the \ browser or use the link to save them and use an adequate viewer.' toc '2:[[',getFile(),'][rda_report][Log Exports]]' } } =head2 Log Files Gathers Oracle Reports, Oracle WebLogic Communication Services (OWLCS), and Oracle Weblogic-related log files. =cut debug ' Inside WLSs module, collecting the log files' pretoc '2:Log Files' call sort_results(3,$TAIL,$WLS_TOP,'$TOP',\ catFile($WLS_TOP,'logs','log.txt'),\ grepDir(catDir($DOMAIN,'servers',$INSTANCE,'logs','reports'),'^[^\.]','dr'),\ grepDir(catDir($DOMAIN,'servers',$INSTANCE,'logs','sdp'),'^[^\.]','dr'),\ grepDir(catDir($DOMAIN,'servers',$INSTANCE,'logs','wlcs'),'^[^\.]','dr')) unpretoc 2 =begin credits =over 10 =item RDA 4.13: Greg Cook, Andrew Salt. =item RDA 4.14: Greg Cook, Eric Gross, Andrew Salt. =item RDA 4.15: Greg Cook, Eric Gross, Ari Kermaier, Andrew Salt, Christo Tonev. =item RDA 4.16: Greg Cook, Sandhya Mohan, Babu Rallapalli, Andrew Salt. =item RDA 4.17: Greg Cook, Adriana Dominguez, Bruce Irvin, Marcus Lachmanez, Andrew Salt. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002-2009, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut