# WLSrun.ctl: Common Macros for Oracle WebLogic Server Run-Time Information # $Id: WLSrun.ctl,v 1.18 2015/10/28 12:46:58 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/WLSrun.ctl,v 1.18 2015/10/28 12:46:58 RDA Exp $ # # Change History # 20151028 KRA Improve debug prompt. =head1 NAME OFM:WLSrun - Defines Common Macros for Oracle WebLogic Server Run-Time Information =head1 DESCRIPTION This persistent submodule regroups macros that are common to several Oracle WebLogic server run-time related-modules. The following macros are available: =cut # Make the module persistent and share macros keep $KEEP_BLOCK,@SHARE_MACROS var @SHARE_MACROS = ('col_cluster','col_diag_images','col_dom_config',\ 'col_dom_runtime','col_log_exports','col_nm_srv_runtime',\ 'col_off_domain','col_off_domain_summary',\ 'col_on_domain_summary','col_servers','col_srv_config',\ 'col_srv_prt','col_srv_runtime','col_thread_dump') use Buffer # Load the common macros run OFM:WLSlib() =head2 S This macro collects domain-wide cluster management objects information (such as the number of C managed under the cluster). =cut macro col_cluster {var ($dom) = @arg debug ' - Inside WLSrun, gathering cluster information' set $cod {def getClusterNames(): " domainConfig() " return cmo.getClusters() " "def extractWlsCluster(clu,bas): " cd(clu) " print "---# RDA:BEGIN SECTION:4:'" + clu + "' Cluster" " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:5|Attributes|'"+clu+"' Topology \ Information ("+bas+')|'+pwd()+'|c_'+clu+'_clu_attributes' " print '---# RDA:BEGIN' " state(clu,'Cluster') " print "---# RDA:END REPORT:5|Status|'"+clu+"' Status Information \ ("+bas+')|'+pwd()+'|c_'+clu+'_clu_status' " print '---# RDA:BEGIN' " viewMBean(cmo) " print "---# RDA:END MACRO MBean:5|MBean|'"+clu+"' Configuration \ Information ("+bas+')|'+pwd()+'|c_'+clu+'_clu_bean' " cd('Servers') " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:5|Servers|'"+clu+"' Managed Servers \ Information ("+bas+')|'+pwd()+'|c_'+clu+'_clu_servers' " cd('..') " print '---# RDA:END SECTION' " cd('..') " "clusterNames = getClusterNames() "cd('Clusters') "print '---# RDA:BEGIN SECTION:3:Clusters' "for nam in clusterNames: " extractWlsCluster(nam.getName(),bas) " "print '---# RDA:END SECTION' "cd('..') " } call writeWas($cod,{bas => $dom}) } =head2 S This macro collects domain-wide server management objects information in offline mode (such as the list of C, C, C, C managed under the domain). =cut macro col_off_domain {var ($dom,$dhp) = @arg debug ' - Inside WLSrun, gathering domain configuration information' set $cod {readDomain(pth) "print '---# RDA:BEGIN' "ls() "print '---# RDA:END MACRO MBean:3|Domain Top Level|Domain Top Level \ Information ('+bas+')|'+pwd()+'|dom_attributes' "try: " cd('Server') " print '---# RDA:BEGIN SECTION:3:Servers' " for srv in ls('c',returnMap='true'): " cd(srv) " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:4|'"+srv+"' Server|'"+srv+"' Topology \ Information ("+bas+')|'+pwd()+'|i_'+srv+'_srv_attributes' " cd('..') " print '---# RDA:END SECTION' " cd('..') "except: " pass "try: " cd('Cluster') " print '---# RDA:BEGIN SECTION:3:Clusters' " for clu in ls('c',returnMap='true'): " cd(clu) " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:4|'"+clu+"' Cluster|'"+clu+"' Topology \ Information ("+bas+')|'+pwd()+'|c_'+clu+'_clu_attributes' " cd('..') " print '---# RDA:END SECTION' " cd('..') "except: " pass "try: " cd('Machines') " print '---# RDA:BEGIN SECTION:3:Machines' " for nod in ls('c',returnMap='true'): " cd(nod) " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:4|'"+nod+"' Machine|'"+nod+"' Topology \ Information ("+bas+')|'+pwd()+'|n_'+nod+'_nod_attributes' " cd('..') " print '---# RDA:END SECTION' " cd('..') "except: " pass "try: " cd('AppDeployment') " print '---# RDA:BEGIN SECTION:3:Applications Deployed' " for app in ls('c',returnMap='true'): " cd(app) " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:4|'"+app+"' Application|'"+app+"' Topology \ Information ("+bas+')|'+pwd()+'|a_'+app+'_app_attributes' " cd('..') " print '---# RDA:END SECTION' " cd('..') "except: " pass "closeDomain() " } call writeWas($cod,{bas => $dom,\ pth => join('/',splitDir($dhp))}) } =head2 S This macro collects domain-wide server management objects summary information in offline mode. =cut macro col_off_domain_summary {var ($dom,$dhp) = @arg debug ' - Inside WLSrun, gathering domain configuration summary \ information (can take time)' set $cod {import java.util.regex.Matcher "import java.util.regex.Pattern "import os "import string " "def findMBean(pat): " cmp_pat = java.util.regex.Pattern.compile(pat) " flg = 'false' " for dir in ls('c',returnMap='true'): " fnd = cmp_pat.matcher(dir) " if fnd.find(): " flg = 'true' " return flg " "def stripMBeanValue(val): " val = str(val) " val = String.replace(val,'Proxy for ','') " val = String.replace(val,'Name=','') " val = String.replace(val,'Type=','') " val = String.replace(val,':',' ') " lst = val.split() " return lst " "readDomain(pth) "print '---# RDA:BEGIN' "print '---+!! Domain Summary ('+bas+')' "print '%TOC%' "print '---+ Top Level Information' "print '|*Domain Name*| *Version*|*Production Mode Enabled?*|\ *Console Enabled?*|*Console Context Path*|' "nam = get('Name') "ver = get('DomainVersion') "prd = get('ProductionModeEnabled') "if prd == 0: " prd = 'False' "else: " prd = 'True' "con = get('ConsoleEnabled') "if con == 0: " con = 'False' "else: " con = 'True' "ctx = get('ConsoleContextPath') "print '|'+nam+' | '+String.replace(ver,'.','.')+'|'+prd+' |'+con+\ ' |'+ctx+' |' "print '[[#Top][Back to top]]' "print '---+ Servers, Clusters, and Machines Information' "try: " cd('Server') " print '---++ All Servers' " print '|*Server Name*|*Cluster*|*Machine*|\ *Default Network%BR%Listen Address*| \ *Default Network%BR%Listen Port*|\ *Default Network%BR%SSL Listen Port*|\ *Custom Network Channel%BR%Name*|\ *Custom Network Channel%BR%Listen Address*|\ *Custom Network Channel%BR%Protocol*|\ *Custom Network Channel%BR%Listen Port*|\ *Java Compiler%BR%Pre Class Path*|\ *Java Compiler%BR%Post Class Path*|' " for srv in ls('c',returnMap='true'): " cd(srv) " clu = get('Cluster') " clu = stripMBeanValue(clu) " lsn_adr = str(get('ListenAddress')) " lsn_prt = str(get('ListenPort')) " mch = get('Machine') " mch = stripMBeanValue(mch) " jcp_pre = String.replace(str(get('JavaCompilerPreClassPath')),\ 'None','%NONE%') " jcp_post = String.replace(str(get('JavaCompilerPostClassPath')),\ 'None','%NONE%') " ssl = findMBean('SSL') " cus_net = findMBean('NetworkAccessPoint') " if ssl == 'true': " cd('SSL/NO_NAME_0') " try: " ssl_lsn_prt = str(get('ListenPort')) " except: " ssl_lsn_prt = '%NULL%' " cd('../..') " else: " ssl_lsn_prt = 'SSL not enabled' " if cus_net == 'true': " cd('NetworkAccessPoint') " for chn in ls('c',returnMap='true'): " cd(chn) " cus_net_adr = str(get('ListenAddress')) " cus_net_prt = str(get('ListenPort')) " cus_net_prc = str(get('Protocol')) " cd('..') " cd('..') " else: " chn = '%NONE%' " cus_net_adr = '%NA%' " cus_net_prt = '%NA%' " cus_net_prc = '%NA%' " print '|'+srv+' |'+String.replace(clu[0],'None','%NONE%')+' |'+mch[0]+' |'+\ lsn_adr+' | '+lsn_prt+'|'+ssl_lsn_prt+' |'+chn+' |'+cus_net_adr+' |'+\ cus_net_prt+' |'+cus_net_prc+' |'+jcp_pre+' |'+jcp_post+' |' " cd('..') " print '[[#Top][Back to top]]' "except: " pass "cd('/') "flg = findMBean('Cluster') "if flg == 'true': " try: " cd('Cluster') " print '---++ Clusters' " print '|*Cluster Name*|*Servers in Cluster*|*Cluster Address*|\ *Cluster Messaging Mode*|*Multicast Address*| *Multicast Port*| \ *WebLogic Plug-in Enabled*|' " for clu in ls('c',returnMap='true'): " cd(clu) " clu_msg = str(get('ClusterMessagingMode')) " clu_plg = str(get('WebLogicPluginEnabled')) " clu_adr = String.replace(str(get('ClusterAddress')),'None','%NONE%') " clu_mca = str(get('MulticastAddress')) " clu_mcp = str(get('MulticastPort')) " cd('../../Server') " clu_tbl = [] " for srv in ls('c',returnMap='true'): " cd(srv) " srv_clu = get('Cluster') " srv_clu = stripMBeanValue(srv_clu) " if srv_clu[0] == clu: " clu_tbl.append(str(srv)) " cd('..') " cd('/Cluster') " print '|'+clu+' |'+'%BR%'.join(clu_tbl)+' |'+\ clu_adr+' |'+clu_msg+' |'+clu_mca+' | '+clu_mcp+'| '+clu_plg+'|' " print '[[#Top][Back to top]]' " cd('..') " except: " pass "cd('/') "flg = findMBean('AnyMachine') "if flg == 'true': " try: " cd('Machines') " print '---++ Machines (NodeManager)' " print '|*Machine Name*|*Listen Address*| *Listen Port*|' " for mch in ls('c',returnMap='true'): " cd(mch) " pth = findMBean('NodeManager') " if pth == 'true': " cd('NodeManager') " alt_pth = findMBean('NodeManager') " if alt_pth == 'true': " cd('NodeManager') " else: " cd(mch) " mch_adr = str(get('ListenAddress')) " mch_prt = str(get('ListenPort')) " print '|'+mch+' |'+mch_adr+' | '+mch_prt+'|' " cd('../../..') " else: " print '|'+mch+' |\ Not Available (No NodeManager associated with this machine) |\ Not Available (No NodeManager associated with this machine) |' " cd('..') " print '[[#Top][Back to top]]' " cd('..') " except: " pass "cd('/') "flg = findMBean('JDBCSystemResource') "if flg == 'true': " print '---+ %ACRONYM:JDBC% Information' " try: " cd('JDBCSystemResource') " print '---++ %ACRONYM:JDBC% System Resources' " mul_src = 'false' " mul_lnk = 'false' " print '|*Name*|*Type*|*Target Name*|*Target Type*|\ *Driver Name*|*Global Transactions Protocol*|\ *%ACRONYM:JDBC% %ACRONYM:URL%*|' " for jsr in ls('c',returnMap='true'): " typ = 'Generic' " cd(jsr) " try: " any_trg = '' " jdbc_trg = get('Target') " if jdbc_trg == 'None': " any_trg = 'None' " no_trg = 1 " else: " any_trg = 'Use jdbc_trg' " no_trg = len(jdbc_trg) " except: " any_trg = 'None' " no_trg = 1 " cd('JdbcResource') " cd(jsr) " grd_lnk = findMBean('JDBCOracleParams') " mul_lnk = findMBean('JDBCDriverParams') " if grd_lnk == 'true': " typ = 'Gridlink' " if mul_lnk == 'false': " typ = 'Multi' " mul_src = 'true' " else: " cd('JDBCDriverParams/NO_NAME_0') " drv = str(get('DriverName')) " url = str(get('URL')) " cd('../..') " cd('JDBCDataSourceParams/NO_NAME_0') " gtp = String.replace(str(get('GlobalTransactionsProtocol')),\ 'None','%NONE%') " cd('../../../../..') " if typ != 'Multi': " if any_trg == 'Use jdbc_trg': " jdbc_trg = stripMBeanValue(jdbc_trg[0]) " print '|'+jsr+' |'+typ+' |'+jdbc_trg[0]+' |'+jdbc_trg[2]+\ ' |'+drv+' |'+gtp+' |'+url+' |' " else: " print '|'+jsr+' |'+typ+' |No targets |%NA% |'+drv+' |'+gtp+' |'+url+' |' " print '[[#Top][Back to top]]' " except: " pass " cd('/') " if mul_src == 'true': " try: " cd('JDBCSystemResource') " print '---++ Multi Data Sources' " print '|*%ACRONYM:JDBC% Data Source Name*|*Contains*|' " for jsr in ls('c',returnMap='true'): " cd(jsr) " cd('JdbcResource') " cd(jsr) " cd('JDBCDataSourceParams/NO_NAME_0') " ds = get('DataSourceList') " cd('../../../../..') " if str(ds) != 'None': " val = String.replace(ds,',',' ') " ds_tbl = val.split() " print '|'+jsr+' |'+str(ds_tbl[0])+' |' " print '[[#Top][Back to top]]' " cd('..') " except: " pass "cd('/') "flg = findMBean('JMSServer') "if flg == 'true': " print '---+ %ACRONYM:JMS% Information' " try: " cd('JMSServer') " print '---++ %ACRONYM:JMS% Servers' " print '|*%ACRONYM:JMS% Server Name*|*Target*|*Persistent Store*|' " for jms in ls('c',returnMap='true'): " cd(jms) " trg = get('Target') " ps = get('PersistentStore') " ps = stripMBeanValue(ps) " print '|'+jms+' |'+str(trg[0])+' |'+str(ps[0])+' |' " cd('..') " print '[[#Top][Back to top]]' " cd('..') " except: " pass "cd('/') "print '---# RDA:END MACRO write_tables:2|Domain Summary|domain_info' "closeDomain() " } call writeWas($cod,{bas => $dom,\ pth => join('/',splitDir($dhp))}) } =head2 S This macro collects domain-wide server management objects summary information in online mode. =cut macro col_on_domain_summary {var ($dom) = @arg debug ' - Inside WLSrun, gathering domain configuration summary \ information (can take time)' set $cod {import java.util.regex.Matcher "import java.util.regex.Pattern "import os "import string "from java.lang import * "from java.util import Date " "def findMBean(pat): " cmp_pat = java.util.regex.Pattern.compile(pat) " flg = 'false' " for dir in ls('c',returnMap='true'): " fnd = cmp_pat.matcher(dir) " if fnd.find(): " flg = 'true' " return flg " "def stripMBeanValue(val,typ): " val = str(val) " val = String.replace(val,'[MBeanServerInvocationHandler]','') " val = String.replace(val,'com.bea:Name=','') " if typ == 'Cluster': " lst = String.replace(val,',Type=Cluster','') " if typ == 'Machine': " val = String.replace(val,',Type=Machine','') " lst = String.replace(val,',Type=UnixMachine','') " if typ == 'JDBC_Server': " val = String.replace(val,'Location=','') " val = String.replace(val,',Type=ServerRuntime','') " val = String.replace(val,',',' ') " lst = val.split() " if typ == 'JDBC_DataSource': " val = String.replace(val,'com.bea:ServerRuntime=','') " val = String.replace(val,'Name=','') " val = String.replace(val,',Type=JDBCDataSourceRuntime','') " val = String.replace(val,',',' ') " lst = val.split() " if typ == 'HealthCheck': " val = String.replace(val,'Component:ServerRuntime,State:','') " val = String.replace(val,'MBean:','') " val = String.replace(val,'Component:','') " val = String.replace(val,'null','') " val = String.replace(val,'State:','') " val = String.replace(val,'ReasonCode:[]','') " val = String.replace(val,',',' ') " lst = val.split() " if typ == 'Target': " val = String.replace(val,\ 'array(weblogic.management.configuration.TargetMBean,','') " val = String.replace(val,'[[MBeanServerInvocationHandler]','') " val = String.replace(val,'com.bea:Name=','') " val = String.replace(val,'array(javax.management.ObjectName,[','') " val = String.replace(val,'Type=','') " val = String.replace(val,'])','') " val = String.replace(val,',',' ') " lst = val.split() " if typ == 'JMSStore': " val = String.replace(val,'com.bea:Name=','') " val = String.replace(val,'Type=','') " val = String.replace(val,',',' ') " lst = val.split() " if typ == 'ThreadPool': " val = String.replace(val,'Component:threadpool,State:','') " val = String.replace(val,'Component:null,State:','') " val = String.replace(val,',MBean:ThreadPoolRuntime','') " lst = String.replace(val,'MBean:null,','') " if typ == 'AppHealth': " val = String.replace(val,'Component:null,State:','') " val = String.replace(val,'MBean:null,','') " val = String.replace(val,',',' ') " lst = val.split() " return lst " "domainConfig() "print '---# RDA:BEGIN' "print '---+!! Domain Summary ('+bas+')' "print '%TOC%' "print '---+ Top Level Information' "print '|*Domain Name*| *Version*|*Production Mode Enabled?*|\ *Console Enabled?*|*Console Context Path*|' "nam = get('Name') "ver = get('DomainVersion') "dhp = get('RootDirectory') "prd = get('ProductionModeEnabled') "if prd == 0: " prd = 'False' "else: " prd = 'True' "con = get('ConsoleEnabled') "if con == 0: " con = 'False' "else: " con = 'True' "ctx = get('ConsoleContextPath') "print '|'+nam+' | '+String.replace(ver,'.','.')+'|'+prd+' |'+con+\ ' |'+ctx+' |' "print '[[#Top][Back to top]]' "print '---+ Servers, Clusters, and Machines Information' "domainRuntime() "try: " cd('ServerLifeCycleRuntimes') " print '---++ All Servers' " print '|*Server Name*|*Status*|*Health State*|*Cluster*|*Machine*|\ *Default Network%BR%Listen Address*| \ *Default Network%BR%Listen Port*|\ *Default Network%BR%SSL Listen Port*|\ *Custom Network Channel%BR%Name*|\ *Custom Network Channel%BR%Listen Address*|\ *Custom Network Channel%BR%Protocol*|\ *Custom Network Channel%BR%Listen Port*|' " for srv in ls('c',returnMap='true'): " cd(srv) " sta = str(cmo.getState()) " if sta != 'SHUTDOWN': " cd('../../ServerRuntimes') " cd(srv) " hth = cmo.getHealthState() " hth = stripMBeanValue(hth,'HealthCheck')[0] " cd('../../ServerLifeCycleRuntimes') " cd(srv) " else: " hth = '%NA%' " serverConfig() " cd('Servers') " cd(srv) " clu = cmo.getCluster() " clu = stripMBeanValue(clu,'Cluster') " lsn_adr = str(cmo.getListenAddress()) " if lsn_adr == '': " lsn_adr = 'All Local Addresses' " lsn_prt = str(cmo.getListenPort()) " mch = cmo.getMachine() " mch = stripMBeanValue(mch,'Machine') " cd('SSL') " cd(srv) " ssl = str(get('Enabled')) " if ssl == 'true': " ssl_lsn_prt = str(get('ListenPort')) " else: " ssl_lsn_prt = 'SSL not enabled' " cd('../../NetworkAccessPoints') " cus_net = ls('c',returnMap='true') " cus_net_cnt = len(cus_net) " if cus_net_cnt > 0: " for chn in cus_net: " cd(chn) " cus_net_adr = str(get('ListenAddress')) " cus_net_prt = str(get('ListenPort')) " cus_net_prc = str(get('Protocol')) " cd('..') " else: " chn = '%NONE%' " cus_net_adr = '%NA%' " cus_net_prt = '%NA%' " cus_net_prc = '%NA%' " print '|'+srv+' |'+sta+' |'+hth+' |'+String.replace(clu,'None','%NONE%')+\ ' |'+mch+' |'+lsn_adr+' | '+lsn_prt+'|'+ssl_lsn_prt+' |'+chn+' |'+\ cus_net_adr+' |'+cus_net_prt+' |'+cus_net_prc+' |' " domainRuntime() " cd('..') " print '[[#Top][Back to top]]' "except: " pass "cd('/') "try: " cd('ServerRuntimes') " print '---++ Running Servers' " print '|*Name*| *%ACRONYM:JVM% Runtime%BR%Heap Free (MB)*| \ *%ACRONYM:JVM% Runtime%BR%Heap Free (%)*| \ *%ACRONYM:JVM% Runtime%BR%Heap Size Current (MB)*| \ *%ACRONYM:JVM% Runtime%BR%Heap Size Max (MB)*|\ *%ACRONYM:JVM% Runtime%BR%Java Vendor*|\ *%ACRONYM:JVM% Runtime%BR%Java Version*|\ *Thread Pool%BR%Health State*| \ *Thread Pool%BR%Completed Requests*| \ *Thread Pool%BR%Throughput*|' " for srv in ls('c',returnMap='true'): " cd(srv) " hth = cmo.getHealthState() " hth = stripMBeanValue(hth,'HealthCheck')[0] " cd('JVMRuntime') " cd(srv) " hp_fre_cur = str(int(cmo.getHeapFreeCurrent())/(1024*1024)) " hp_fre_per = str(cmo.getHeapFreePercent()) " hp_siz_cur = str(int(cmo.getHeapSizeCurrent())/(1024*1024)) " hp_siz_max = str(int(cmo.getHeapSizeMax())/(1024*1024)) " java_ven = str(cmo.getJavaVendor()) " java_ver = str(cmo.getJavaVersion()) " cd('../../ThreadPoolRuntime/ThreadPoolRuntime') " hog_thd = cmo.getHoggingThreadCount() " thd_hth = cmo.getHealthState() " thd_hth = stripMBeanValue(thd_hth,'ThreadPool') " req_cnt = str(cmo.getCompletedRequestCount()) " thr_put = str(cmo.getThroughput()) " if hth == 'FAILED' or hog_thd > 0: " thd_det = 'true' " else: " thd_det = 'false' " cd('../../..') " print '|'+srv+' | '+hp_fre_cur+'| '+hp_fre_per+'| '+hp_siz_cur+'| '+\ hp_siz_max+'|'+java_ven+' |'+java_ver+' |'+thd_hth+' | '+req_cnt+'| '+\ thr_put+'|' " print '[[#Top][Back to top]]' " if thd_det == 'true': " print '---+++ More Thread Pool Information' " print '|*Server Name*|*Thread Runtime Health State*| \ *Total Threads*| *Idle Threads*| *Hogging Threads*| \ *Pending Threads*| *Thread Pool*|' " for srv in ls('c',returnMap='true'): " cd(srv) " hth = cmo.getHealthState() " hth = stripMBeanValue(hth,'HealthCheck')[0] " if hth != 'HEALTH_OK': " cd('ThreadPoolRuntime/ThreadPoolRuntime') " hth_sta = cmo.getHealthState() " hth_sta = stripMBeanValue(hth_sta,'ThreadPool') " tot_thd = str(cmo.getExecuteThreadTotalCount()) " idl_thd = str(cmo.getExecuteThreadIdleCount()) " hog_thd = str(cmo.getHoggingThreadCount()) " pen_thd = str(cmo.getPendingUserRequestCount()) " pol_thd = str(cmo.getQueueLength()) " print '|'+srv+' |'+hth_sta+' | '+tot_thd+'| '+idl_thd+'| '+hog_thd+'| '+\ pen_thd+'| '+pol_thd+'|' " cd('../../..') " else: " cd('..') " print '[[#Top][Back to top]]' "except: " pass "serverConfig() "flg = findMBean('Clusters') "if flg == 'true': " try: " cd('Clusters') " print '---++ Clusters' " print '|*Cluster Name*|*Servers in Cluster*|*Cluster Address*|\ *Cluster Messaging Mode*|*Multicast Address*| *Multicast Port*| \ *WebLogic Plug-in Enabled*|' " for clu in ls('c',returnMap='true'): " cd(clu) " clu_msg = str(get('ClusterMessagingMode')) " clu_plg = str(get('WeblogicPluginEnabled')) " clu_adr = String.replace(str(get('ClusterAddress')),'None','%NONE%') " clu_mca = str(get('MulticastAddress')) " clu_mcp = str(get('MulticastPort')) " cd('Servers') " clu_tbl = [] " for srv in ls('c',returnMap='true'): " clu_tbl.append(str(srv)) " cd('../..') " print '|'+clu+' |'+'%BR%'.join(clu_tbl)+' |'+\ clu_adr+' |'+clu_msg+' |'+clu_mca+' | '+clu_mcp+'| '+clu_plg+'|' " print '[[#Top][Back to top]]' " cd('..') " except: " pass "cd('/') "flg = findMBean('Machines') "if flg == 'true': " try: " cd('Machines') " print '---++ Machines (NodeManager)' " print '|*Machine Name*|*Listen Address*| *Listen Port*|' " for mch in ls('c',returnMap='true'): " cd(mch) " pth = findMBean('NodeManager') " if pth == 'true': " cd('NodeManager') " alt_pth = findMBean('NodeManager') " if alt_pth == 'true': " cd('NodeManager') " else: " cd(mch) " mch_adr = str(get('ListenAddress')) " mch_prt = str(get('ListenPort')) " print '|'+mch+' |'+mch_adr+' | '+mch_prt+'|' " cd('../../..') " else: " print '|'+mch+' |\ Not Available (No NodeManager associated with this machine) |\ Not Available (No NodeManager associated with this machine) |' " cd('..') " print '[[#Top][Back to top]]' " cd('..') " except: " pass "cd('/') "domainRuntime() "try: " cd('ServerRuntimes') " print '---+ Application Runtime Information' " print '|*Server*|*Application Name*|*Health State*|' " for srv in ls('c',returnMap='true'): " cd(srv) " cd('ApplicationRuntimes') " apps = ls('c',returnMap='true') " app_cnt = len(apps) " row = 'false' " for app in apps: " cd(app) " nam = str(cmo.getName()) " hth = cmo.getHealthState() " hth = str(stripMBeanValue(hth,'AppHealth')) " if row == 'true': " print '|^^^|'+nam+' |'+hth+' |' " else: " print '|%MIDDLE:'+str(app_cnt)+'%'+srv+' |'+nam+' |'+hth+' |' " row = 'true' " cd('..') " cd('../..') " print '[[#Top][Back to top]]' "except: " pass "serverConfig() "flg = findMBean('JDBCSystemResources') "if flg == 'true': " print '---+ %ACRONYM:JDBC% Information' " try: " cd('JDBCSystemResources') " print '---++ %ACRONYM:JDBC% System Resources' " mul_src = 'false' " print '|*Name*|*Type*|*Target Name*|*Target Type*|\ *Driver Name*|*Global Transactions Protocol*|\ *%ACRONYM:JDBC% %ACRONYM:URL%*|' " for jsr in ls('c',returnMap='true'): " cd(jsr) " try: " any_trg = '' " jdbc_trg = get('Targets') " no_trg = len(jdbc_trg) " except: " no_trg = 0 " cd('JDBCResource') " cd(jsr) " cd('JDBCDriverParams') " cd(jsr) " typ = 'Generic' " drv = str(get('DriverName')) " url = str(get('Url')) " cd('../..') " cd('JDBCDataSourceParams') " cd(jsr) " gtp = String.replace(str(get('GlobalTransactionsProtocol')),\ 'None','%NONE%') " dsl = str(get('DataSourceList')) " cd('../../JDBCOracleParams') " cd(jsr) " one = str(get('OnsNodeList')) " if drv == 'None': " typ = 'Multi' " drv = '%NA%' " url = '%NA%' " gtp = '%NA%' " mul_src = 'true' " else: " dsl = '%NA%' " if one != 'None': " typ = 'GridLink' " one = '' " cd('../../../../..') " if typ != 'Multi': " if no_trg > 0: " row = 'false' " for val in jdbc_trg: " val = stripMBeanValue(val,'Target') " if row == 'true': " print '|^^^|^^^|'+val[0]+' |'+val[1]+' |^^^|^^^|^^^|' " else: " print '|%MIDDLE:'+str(no_trg)+'%'+jsr+' |%MIDDLE:'+str(no_trg)+'%'+\ typ+' |'+val[0]+' |'+val[1]+' |%MIDDLE:'+str(no_trg)+'%'+drv+\ ' |%MIDDLE:'+str(no_trg)+'%'+gtp+' |%MIDDLE:'+str(no_trg)+'%'+url+' |' " row = 'true' " else: " print '|'+jsr+' |'+typ+' |%NONE% |%NA% |'+drv+' |'+gtp+' |'+url+' |' " print '[[#Top][Back to top]]' " except: " pass " cd('/') " if mul_src == 'true': " try: " cd('JDBCSystemResources') " print '---++ Multi Data Sources' " print '|*%ACRONYM:JDBC% Data Source Name*|*Contains*|' " for jsr in ls('c',returnMap='true'): " cd(jsr) " cd('JDBCResource') " cd(jsr) " cd('JDBCDataSourceParams') " cd(jsr) " dsl = str(get('DataSourceList')) " cd('../../../../..') " if dsl != 'None': " val = String.replace(dsl,',',' ') " ds_tbl = val.split() " ds_tbl_cnt = len(ds_tbl) " row = 'false' " for val in ds_tbl: " if row == 'true': " print '|^^^|'+val+' |' " else: " print '|%MIDDLE:'+str(ds_tbl_cnt)+'%'+jsr+' |'+val+' |' " row = 'true' " print '[[#Top][Back to top]]' " cd('..') " except: " pass " cd('/') " srv_obj = domainRuntimeService.getServerRuntimes() " jdbc = 'false' " for srv in srv_obj: " jdbc_run = srv.getJDBCServiceRuntime() " ds = jdbc_run.getJDBCDataSourceRuntimeMBeans() " no_ds = len(ds) " if no_ds > 0: " jdbc = 'true' " if jdbc == 'true': " print '---++ %ACRONYM:JDBC% Runtime Information' " print '|*Server Name*|*%ACRONYM:JDBC% Data Source \ Name*|*State*| *Connections%BR%Active*| *Connections%BR%Waiting*| \ *Connections%BR%Leaked*| *Connections%BR%Current Capacity*|' " for srv in srv_obj: " jdbc_run = srv.getJDBCServiceRuntime() " dsr = jdbc_run.getJDBCDataSourceRuntimeMBeans() " no_ds = len(dsr) " if no_ds > 0: " row = 'false' " for ds in dsr: " act = str(ds.getActiveConnectionsCurrentCount()) " wtg = str(ds.getWaitingForConnectionCurrentCount()) " sta = str(ds.getState()) " cnt = str(ds.getLeakedConnectionCount()) " cap = str(ds.getCurrCapacity()) " if row == 'true': " print '|^^^|'+stripMBeanValue(ds,'JDBC_DataSource')[1]+' |'+sta+\ ' | '+act+'| '+wtg+'| '+cnt+'| '+cap+'|' " else: " print '|%MIDDLE:'+str(no_ds)+'%'+\ stripMBeanValue(srv,'JDBC_Server')[1]+' |'+\ stripMBeanValue(ds,'JDBC_DataSource')[1]+' |'+sta+' | '+act+'| '+\ wtg+'| '+cnt+'| '+cap+'|' " row = 'true' " print '[[#Top][Back to top]]' "cd('/') "flg = findMBean('JMSServers') "if flg == 'true': " try: " cd('JMSServers') " tbl = ls('c',returnMap='true') " if len(tbl) > 0: " print '---+ %ACRONYM:JMS% Information' " print '---++ %ACRONYM:JMS% Servers' " print '|*%ACRONYM:JMS% Server Name*|*Target*|*Persistent Store*|' " for jms in tbl: " cd(jms) " trg = get('Targets') " ps = get('PersistentStore') " ps = stripMBeanValue(ps,'JMSStore') " for val in trg: " val = stripMBeanValue(val,'Target') " print '|'+jms+' |'+str(val[0])+' |'+str(ps[0])+' |' " cd('..') " print '[[#Top][Back to top]]' " cd('/') " jms = 'false' " print '---++ %ACRONYM:JMS% Runtime Information' " for srv in domainRuntimeService.getServerRuntimes(): " jms_run = srv.getJMSRuntime() " jms_srv = jms_run.getJMSServers() " no_jms_srv = len(jms_srv) " if no_jms_srv > 0: " jms = 'true' " if jms == 'true': " for jms_s in jms_srv: " trg = str(jms_s.getName()) " print '---+++ '+trg " tbl_dst = jms_s.getDestinations() " if len(tbl_dst) > 0: " print '|*Destination*|*Type*| *Messages%BR%Current Count*| \ *Messages%BR%High Count*| *Messages%BR%Pending Count*| \ *Messages%BR%Deleted Current Count*|' " for dst in tbl_dst: " nam = str(dst.getName()) " typ = str(dst.getDestinationType()) " cur = str(dst.getMessagesCurrentCount()) " hig = str(dst.getMessagesHighCount()) " pen = str(dst.getMessagesPendingCount()) " de = str(dst.getMessagesDeletedCurrentCount()) " print '|'+nam+' |'+typ+' | '+cur+'| '+hig+'| '+pen+'| '+de+'|' " print '[[#Top][Back to top]]' " except: " pass "print '---# RDA:END MACRO write_tables:2|Domain Summary|domain_info' " } call writeWas($cod,{bas => $dom}) } =head2 S This macro collects domain-wide server management objects information (such as the list of C managed under the domain). =cut macro col_servers {var ($dom) = @arg debug ' - Inside WLSrun, gathering domain servers information' set $cod {def getServerNames(): " domainConfig() " return cmo.getServers() " "def extractWlsServers(srv,bas): " cd(srv) " print "---# RDA:BEGIN SECTION:4:'" + srv + "' Server" " print '---# RDA:BEGIN' " ls() " print "---# RDA:END MACRO MBean:5|Attributes|'"+srv+"' Topology \ Information ("+bas+')|'+pwd()+'|i_'+srv+'_srv_attributes' " print '---# RDA:BEGIN' " state(srv,'Server') " print "---# RDA:END REPORT:5|Status|'"+srv+"' Status Information \ ("+bas+')|'+pwd()+'|i_'+srv+'_srv_status' " print '---# RDA:BEGIN' " viewMBean(cmo) " print "---# RDA:END MACRO MBean:5|MBean|'"+srv+"' Configuration \ Information ("+bas+')|'+pwd()+'|i_'+srv+'_srv_bean' " print '---# RDA:END SECTION' " cd('..') " "serverNames = getServerNames() "cd('Servers') "print '---# RDA:BEGIN SECTION:3:Servers' "for nam in serverNames: " extractWlsServers(nam.getName(),bas) " "print '---# RDA:END SECTION' "cd('..') " } call writeWas($cod,{bas => $dom}) } =head2 S This macro collects domain-wide configuration management objects information (such as C, C, C, C, C, C, and C). =cut macro col_dom_config {var ($dom,$PLUGIN) = @arg debug ' - Inside WLSrun, gathering domain configuration information' set $cod {print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:3|Domain Configuration|Domain Configuration \ Information ('+bas+')|'+pwd()+'|dom_config' "cd('Log') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|Domain Log Configuration|Domain Log \ Configuration Information ('+bas+')|'+pwd()+'|log_config' "cd('..') "cd('LogFilters') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|Log Filters Configuration|Domain Log \ Filters Configuration Information ('+bas+')|'+pwd()+'|log_filter_config' "cd('..') "cd('VirtualHosts') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|Virtual Hosts Configuration|Domain \ Virtual Hosts Configuration Information ('+bas+')|'+pwd()+\ '|virt_hst_config' "cd('..') "cd('JDBCSystemResources') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|JDBC System Resources Configuration|Domain \ JDBC System Resources Configuration Information ('+bas+')|'+pwd()+\ '|jdbc_config' "cd('..') "cd('JMSServers') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|JMS Servers Configuration|Domain JMS \ Servers Configuration Information ('+bas+')|'+pwd()+'|jms_svr_config' "cd('..') "cd('JMSSystemResources') "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|JMS System Resources Configuration|Domain \ JMS System Resources Configuration Information ('+bas+')|'+pwd()+\ '|jms_sys_config' "cd('..') " } loop $prd (keys($PLUGIN->{'WLS','dom'})) var $cod = join("\012",$cod,'',$PLUGIN->{'WLS','dom',$prd}) call writeWas($cod,{bas => $dom}) } =head2 S This macro collects domain-wide run-time management objects information (such as C, C, C, C, C, C, and C). =cut macro col_dom_runtime {var ($dom,$PLUGIN) = @arg import $TAIL,$WLST_DIR debug ' - Inside WLSrun, gathering domain runtime information' var $AS11 = and($WLST_DIR,\ grepDir(catDir($WLST_DIR,'wlst'),\ '^oracle(dms|odl|-logging)\.py$','if')) set $cod {import string "domainRuntime() "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:3|Domain Run-Time|Domain Run-Time \ Information ('+bas+')|'+pwd()+'|dom_runtime' "cd("LogRuntime/"+domainName) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|Domain Log Run-Time|Domain Log Run-Time \ Information ('+bas+')|'+pwd()+'|log_runtime' "cd('../..') "cd("DomainServices") "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print '---# RDA:END MACRO MBean:4|Domain Services|Domain Services Run-Time \ Information ('+bas+')|'+pwd()+'|dom_service' "cd('..') "if AS11 == 1: " print '---# RDA:BEGIN SECTION:4:Log Queries' " print '---# RDA:BEGIN' " displayLogs(last=1440,groupBy=['COMPONENT_ID','MODULE_ID','MSG_TYPE']) " print '---# RDA:END REPORT:5|Activities over last 24 Hours|Domain \ Activities over last 24 Hours ('+bas+')|'+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:5|Last Warnings and Errors for '+cid+'|Domain \ Last Warnings and Errors for '+cid+' ('+bas+')|'+pwd()+\ '|dom_odl_com_'+cid " except: " pass " " print '---# RDA:END SECTION' " print '---# RDA:BEGIN' " dumpMetrics(format="raw") " print '---# RDA:END REPORT:4|dumpMetrics|Domain DMS Dump Metrics ('+bas+\ ')|'+pwd()+'|dom_dump_metrics' " "domainConfig() "print '---# RDA:BEGIN' "print '---+ Applications Status Information ('+bas+')' "print '|*Server Name*|*Application Name*|*Status*|' "cd('AppDeployments') "apps = cmo.getAppDeployments() "for app in apps: " domainConfig() " cd('/AppDeployments/'+app.getName()+'/Targets') " tb_trg = ls('c',returnMap='true') " domainRuntime() " cd('AppRuntimeStateRuntime') " cd('AppRuntimeStateRuntime') " for trg in tb_trg: " cur = cmo.getCurrentState(app.getName(),trg) " print '|'+trg+' |'+String.replace(app.getName(),'.','.')+' |'+cur+' |' "print '[[#Top][Back to top]]' "print '---# RDA:END MACRO write_tables:4|Applications Status|app_sta' " } loop $prd (keys($PLUGIN->{'WLS','domrun'})) var $cod = join("\012",$cod,'',$PLUGIN->{'WLS','domrun',$prd}) call writeWas($cod,{'+AS11',$AS11,\ '+TAIL',$TAIL,\ bas => $dom}) } =head2 S This macro collects server configuration management objects information. =cut macro col_srv_config {var ($dom,$srv,$PLUGIN) = @arg debug ' - Inside WLSrun, gathering server configuration information' set $cod {import re " "def getConfigData(dir,ins,ttl,rpt,bas): " try: " cd(dir) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print '---# RDA:END MACRO MBean:5|'+ttl+"|'"+ins+"' "+ttl+' Configuration \ Information ('+bas+')|'+pwd()+'|i_'+ins+'_'+rpt " cd('..') " except WLSTException,e: " pass " "print '---# RDA:BEGIN SECTION:3:Server Configuration' "cd("Servers") "for trg in ls('c',returnMap='true'): " if re.match(trg,ins,re.I): " srv=trg " cd(trg) " break "print '---# RDA:BEGIN' "ls() "print "---# RDA:END MACRO MBean:4|Attributes|'"+ins+"' Topology Information \ ("+bas+')|'+pwd()+'|i_'+ins+'_ins_attributes' "print '---# RDA:BEGIN' "state(srv,'Server') "print "---# RDA:END REPORT:4|Status|'"+ins+"' Status Information \ ("+bas+')|'+pwd()+'|i_'+ins+'_ins_status' "print '---# RDA:BEGIN' "viewMBean(cmo) "print "---# RDA:END MACRO MBean:4|MBean|'"+ins+"' Configuration Information \ ("+bas+')|'+pwd()+'|i_'+ins+'_ins_bean' "cd("Log/"+srv) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END MACRO MBean:4|Server Log|'"+ins+"' Log Configuration \ Information ("+bas+')|'+pwd()+'|i_'+ins+'_svr_log' "getConfigData('LogFileFilter',ins,'Log File Filter','log_fil_filter',bas) "getConfigData('MemoryBufferFilter',ins,'Memory Buffer Filter',\ 'mem_buf_filter',bas) "getConfigData('StdoutFilter',ins,'Stdout Filter','std_out_filter',bas) "cd('../..') "cd("WebServer/"+srv) "print '---# RDA:BEGIN' "ls() "viewMBean(cmo) "print "---# RDA:END MACRO MBean:4|Web Server|'"+ins+"' Web Server \ Configuration Information ("+bas+')|'+pwd()+'|i_'+ins+'_web_server' "getConfigData("WebServerLog/"+srv,ins,'Web Server Log','web_svr_log',bas) "cd('../../../../..') "print '---# RDA:END SECTION' " } loop $prd (keys($PLUGIN->{'WLS','srv'})) var $cod = join("\012",$cod,'',$PLUGIN->{'WLS','srv',$prd}) call writeWas($cod,{bas => $dom,\ ins => $srv}) } =head2 S This macro collects the server address and its associated port information. =cut macro col_srv_prt {var (\%hst,\%prt,$srv) = @arg debug ' - Inside WLSrun, gathering server port information' set $cod {import re "cd("Servers") "for trg in ls('c',returnMap='true'): " if re.match(trg,ins,re.I): " cd(trg) " print '---# RDA:SET VARIABLE:WLSH:'+ins+'="'+str(get('ListenAddress'))+'"' " print '---# RDA:SET VARIABLE:WLSP:'+ins+'="'+str(get('ListenPort'))+'"' " break "cd('../..') " } call writeWas($cod,{ins => $srv}) var %hst = getWasGroup('WLSH') var %prt = getWasGroup('WLSP') } =head2 S This macro collects server run-time management objects information using node\ manager. =cut macro col_nm_srv_runtime {var ($dom,$srv) = @arg debug ' - Inside WLSrun, gathering node manager server runtime information' set $cod {try: " print '---# RDA:BEGIN' " nmServerStatus(ins,serverType="OHS") " print "---# RDA:END REPORT:3|Status|'"+ins+"' Status Information ("+\ bas+')|'+pwd()+'|i_'+ins+'_nm_svr_status' "except WLSTException,e: " pass "try: " print '---# RDA:BEGIN' " displayMetricTables(servertype="OHS",servers=(ins)) " print "---# RDA:END REPORT:3|displayMetricTables|'"+ins+\ "' Metrics Tables ("+bas+')|'+pwd()+'|i_'+ins+'_nm_svr_metric_tbl' "except WLSTException,e: " pass "try: " print '---# RDA:BEGIN' " dumpMetrics(servertype="OHS",servers=(ins),format="raw") " print "---# RDA:END REPORT:3|dumpMetrics|'"+ins+"' DMS Dump Metrics ("+\ bas+')|'+pwd()+'|i_'+ins+'_nm_svr_dump_metrics' "except WLSTException,e: " pass " } call writeWas($cod,{bas => $dom,\ ins => $srv}) } =head2 S This macro collects server run-time management objects information. =cut macro col_srv_runtime {var ($dom,$srv,$PLUGIN) = @arg import $TAIL,$WLST_DIR debug ' - Inside WLSrun, gathering server runtime information' var $AS11 = and($WLST_DIR,\ grepDir(catDir($WLST_DIR,'wlst'),\ '^(oracledms|oracle-logging)\.py$','if')) set $cod {import re " "domainRuntime() "try: " cd("ServerRuntimes") " for trg in ls('c',returnMap='true'): " if re.match(trg,ins,re.I): " srv=trg " cd(srv) " break " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END MACRO MBean:3|Server Run-Time|'"+ins+"' Server Run-Time \ Information ("+bas+')|'+pwd()+'|i_'+ins+'_svr_runtime' " cd('ClusterRuntime') " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END MACRO MBean:4|Cluster Run-Time|'"+ins+"' Cluster Run-Time \ Information ("+bas+')|'+pwd()+'|i_'+ins+'_svr_clu_runtime' " cd('..') " cd("JDBCServiceRuntime/"+srv) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END MACRO MBean:4|JDBC Service Run-Time|'"+ins+"' JDBC \ Service Run-Time Information ("+bas+')|'+pwd()+'|i_'+ins+\ '_svr_jdbc_runtime' " cd('../..') " cd("JMSRuntime/"+srv+".jms") " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END MACRO MBean:4|JMS Run-Time|'"+ins+"' JMS Run-Time \ Information ("+bas+')|'+pwd()+'|i_'+ins+'_svr_jms_runtime' " cd('../..') " cd("JVMRuntime/"+srv) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END MACRO MBean:4|JVM Run-Time|'"+ins+"' JVM Run-Time \ Information ("+bas+')|'+pwd()+'|i_'+ins+'_svr_jvm_runtime' " cd('../..') " cd("LogRuntime/"+srv) " print '---# RDA:BEGIN' " ls() " viewMBean(cmo) " print "---# RDA:END MACRO MBean:4|Server Log Run-Time|'"+ins+"' Log Run-Time \ Information ("+bas+')|'+pwd()+'|i_'+ins+'_svr_log_runtime' " cd('../..') " if AS11 == 1: " print '---# RDA:BEGIN SECTION:4:Log Queries' " print '---# RDA:BEGIN' " displayLogs(target=srv,last=1440,\ groupBy=['COMPONENT_ID','MODULE_ID','MSG_TYPE']) " print "---# RDA:END REPORT:5|Activities over last 24 Hours|'"+ins+\ "' Activities over last 24 Hours ("+bas+')|'+pwd()+'|i_'+ins+\ '_odl_24h' " tb_cid = displayLogs(target=srv,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:5|Last Warnings and Errors for '+cid+"|'"+\ ins+"' Last Warnings and Errors for "+cid+' ('+bas+')|'+pwd()+\ '|i_'+ins+'_odl_com_'+cid " except: " pass " print '---# RDA:END SECTION' " print '---# RDA:BEGIN' " dumpMetrics(format="raw",servers=(srv)) " print "---# RDA:END REPORT:4|dumpMetrics|'"+ins+"' DMS Dump Metrics ("+\ bas+')|'+pwd()+'|i_'+ins+'_svr_dump_metrics' " " cd('../..') "except WLSTException,e: " pass " } loop $prd (keys($PLUGIN->{'WLS','srvrun'})) var $cod = join("\012",$cod,'',$PLUGIN->{'WLS','srvrun',$prd}) call writeWas($cod,{'+AS11',$AS11,\ '+TAIL',$TAIL,\ bas => $dom,\ ins => $srv}) } =head2 S This macro 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. =cut macro col_diag_images {var ($dom,$srv,$hst,$prt,$usr,$pwd) = @arg import $RPT_DIRECTORY,$TIMEOUT debug ' - Inside WLSrun, capturing server diagnostic image' 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 setWasLogin($usr,$pwd,concat($hst,':',$prt)) call requestWas($cod,{bas => $dom,rpt => join('/',splitDir($RPT_DIRECTORY))}) if grepDir($RPT_DIRECTORY,\ concat('^diagnostic_image_',verbatim($srv),\ '_\d{4}_\d{2}_\d{2}_\d{2}_\d{2}_\d{2}\.zip$'),\ 'it') {var ($nam) = (last) data $nam var ($tim,$img) = ($TIMEOUT,getRawLink(true)) while expr('>',$tim,0) {sleep 5 if transfer($RPT_DIRECTORY,$nam,$RPT_DIRECTORY,basename($img)) {report concat('i_',$srv,'_diag_image') write "---+ '",$srv,"' Diagnostic Image Data (",$dom,')' write " * The diagnostic image was taken at the time RDA was run. If the \ Oracle WebLogic server has Diagnostic Framework (DFW) enabled, \ diagnostic images created by the DFW at the time incidents \ occured are also collected. To view diagnostic images created \ by the DFW, go to the 'Diagnostic Repository' section." 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.' write '|*Image Name*|' write '|[[',$img,'][_blank][',$nam,']]|' toc '3:[[',getFile(),'][rda_report][Diagnostic Images]]' break } decr $tim,5 } } } =head2 S This macro 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. =cut macro col_log_exports {var ($wls,$dom,$srv,$hst,$prt,$usr,$pwd) = @arg import $ADMIN,$LOG_AGE,$TYPE debug ' - Inside WLSrun, collecting log information' var %log = () var @tbl = ('EventsDataArchive','HarvestedDataArchive','ServerLog') if $wls {if compare('eq',$srv,$ADMIN) call push(@tbl,'DomainLog') } elsif ?$wls call push(@tbl,'ConnectorLog','DomainLog','JMSMessageLog','WebAppLog') else var @tbl = () if @tbl {loop $log (@tbl) {if compare('ne',$TYPE,'OFF') next and(compare('eq',$log,'DomainLog'),compare('ne',$srv,$ADMIN)) data $log = concat('i_',$srv,'_',$log) var $log{$log} = [getFile('/'),getRawLink(true)] } var @tbl = keys(%log) var $end = time() var $beg = expr('-',$end,expr('*',$LOG_AGE,86400)) var ($str,%fil) = (concat('i_',$srv,'_')) var $pat = verbatim($str) loop $log (grep(@tbl,verbatim($srv))) var $fil{replace($log{$log}->[0],'\\','/',true)} = replace($log,$pat) 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 setWasLogin($usr,$pwd,concat($hst,':',$prt)) call requestWas($cod,\ {'+beg',concat($beg,'000L'),'+end',concat($end,'000L'),fil => {%fil}}) } else {set $cod {for pth in fil.keys(): " try: " exportDiagnosticData(logicalName=fil[pth],exportFileName=pth) " except WLSTException,e: " pass " } var $cmd = 'exportDiagnosticData' call requestWas($cod,{fil => {%fil}}) } report concat($str,'log_info') prefix {write "---+ '",$srv,"' Log Exports (",$dom,')' write '---## Using: ',$cmd 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.' write '|*Exported Data*|' } loop $log (grep(@tbl,$pat)) {if ?testFile('s',$log{$log}->[0]) write '|[[',$log{$log}->[1],'][_blank][',replace($log,$pat),']]|' } if isCreated(true) toc '3:[[',getFile(),'][rda_report][Log Exports]]' } } =head2 S This macro gathers the thread dump information for the specified server. RDA uses C in connected mode. =cut macro col_thread_dump {var ($dom,$srv,$hst,$prt,$usr,$pwd) = @arg import $THREAD_DUMP,$THREAD_DUMP_INT debug ' - Inside WLSrun, gathering thread dump data' set $cod {import datetime "print "---# RDA:BEGIN LIST" "for cnt in range(THREAD_DUMP): " java.lang.Thread.sleep(THREAD_DUMP_INT) " tim=datetime.datetime.utcnow().strftime("%Y%m%d_%H%M%S") " print '---# RDA:BEGIN' " threadDump(writeToFile='false') " print "---# RDA:END DATA:dump"+ins+'_'+tim+".dmp|i_"+ins+"_dump_"+tim "print "---# RDA:END LIST write_list:3|Thread Dump|'"+ins+"' Latest "+\ str(THREAD_DUMP)+' Thread Dumps ('+bas+')|Using: threadDump|i_'+ins+\ '_thread_dump' } call setWasLogin($usr,$pwd,concat($hst,':',$prt)) call writeWas($cod,{'+THREAD_DUMP',$THREAD_DUMP,\ '+THREAD_DUMP_INT',$THREAD_DUMP_INT,\ bas => $dom,\ ins => $srv}) } =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.26: Wes Root, Maria Salzberger. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut