# DCwsp.ctl:302:Collects IBM WebSphere Application Server Information # $Id: DCwsp.ctl,v 1.6 2015/10/28 14:21:10 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCwsp.ctl,v 1.6 2015/10/28 14:21:10 RDA Exp $ # # Change History # 20151028 MSC Enhance the filtering capabilities. =head1 NAME OFM:DCwsp - Collects IBM WebSphere Application Server Information =head1 DESCRIPTION This module collects IBM WebSphere Application Server-related information for a single or multiple servers opted by the user. The module covers the following WebSphere Application Server products: =over 3 =item o Network Deployment (ND) Release 7.x. =item o Base Application Server (AS) Release 7.x. =back The following reports can be generated and are regrouped under C: =head1 REPORTS =cut echo tput('bold'),'Processing OFM.WSP module ...',tput('off') # Initialization var $AUTO = ${B_AUTH_AUTO} var $INCIDENT_FILES = ${N_INCIDENT_FILES:5} var $PROFILE_ROOT = ${D_PROFILE_ROOT:''} var $TAIL = ${DFT.N_TAIL:1000} var $TYPE = uc(${W_TYPE:'OFF'}) var @CELLS = () var %ABBR = () var %LOGINS = () var %NODES = () var %SERVERS = () var $WSP_TOP = '' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' # Define duplicate file hash var %DUP var %FLT # Load the common macros run OFM:WASlib() pretoc '1:IBM WebSphere (',check($TYPE,'MANY','Multiple Servers',\ 'ONE', 'Single Server',\ 'Offline'),')' # Determine the cell list loop $itm (@{T_CELLS}) {var ($pro,$cel) = split(':',$itm) var $dir = catDir($PROFILE_ROOT,$pro,'config','cells',$cel) if ?testFile('f',catFile($dir,'virtualhosts.xml')) {call push(@CELLS,$itm) var $NODES{$itm} = {} var $SERVERS{$itm} = {} } } # Determine the server list loop $itm (@{T_SERVERS}) {var ($pro,$cel,$nod,$srv) = split(':',$itm) var $key = concat($pro,':',$cel) var $dir = catDir($PROFILE_ROOT,$pro,'config','cells',$cel,'nodes',$nod) if and(exists($NODES{$key}),testFile('f',catFile($dir,'serverindex.xml'))) {var $NODES{$key,join(':',$pro,$cel,$nod)} = -1 if and(exists($SERVERS{$key}),\ testFile('f',catFile($dir,'servers',$srv,'server.xml'))) var $SERVERS{$key,$itm} = -1 } } # Get user details if and(compare('ne',$TYPE,'OFF'),not($AUTO)) {# Load setup information var (%cpw,%upw,%usr) = () loop $uid (keys(${T_USERS})) {var (undef,$cel) = split(':',$uid) # Determine the cell user if $flg = length($usr = nvl(${T_USERS}->{$uid},'')) var $usr{$cel} = $usr # Determine the cell/user password if hasPassword('wsp',$cel,$usr) {var $cpw{$cel} = true var $upw{$usr} = true } elsif $flg {call setPassword('wsp',$cel,$usr,askPassword(\ concat("Enter '",$usr,"' user password:"))) var $cpw{$cel} = true var $upw{$usr} = true } } # Get user passwords loop $itm (@CELLS) {if and(exists($usr{$itm}),exists($cpw{$itm})) var $LOGINS{$itm} = $usr{$itm} else {var $LOGINS{$itm} = undef var ($pro,$cel) = split(':',$itm) var $dir = catDir($PROFILE_ROOT,$pro,'config','cells',$cel) if ?testFile('fr',catFile($dir,'fileRegistry.xml')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) if xmlFind($obj,'sdo:datagraph/wim:Root/wim:entities \ xsi:type="wim:PersonAccount"/wim:uid') {var $usr = xmlData(last) if match($usr,'^\w+$') {if missing($upw{$usr}) {call setPassword('wsp',$itm,$usr,askPassword(\ concat("Enter '",$usr,"' user password:"))) var $cpw{$itm} = true var $upw{$usr} = true } var $LOGINS{$itm} = $usr } } } } } } =head2 rda_col - Collection Shortcuts Displays RDA collection shortcuts used for IBM WebSphere Application Server. =cut var $map = $[OUT]->add_report('c','rda_col',0) toc '2:[[',$map->get_report,'][rda_report][Collection Shortcuts]]' =head2 WSADMIN Start Scripts Gathers IBM WebSphere Application Server Administration Tool-related start scripts. =head2 wsadmin_cmd_list - WSADMIN Command Files List Lists IBM WebSphere Application Server Administration Tool-related command files. =cut call setWasType('WSP') var $chk = cond(isWindows(),'f',isCygwin(),'f','fx') loop $hom (@{D_HOMES}) {var $WSP_TOP = dirname($hom) var $WSADMIN_DIR = $hom if ?testDir('d',catDir($hom,'common')) var $WSADMIN_DIR = lastDir() if ?testFile($chk,catFile($WSADMIN_DIR,'bin',${AS.CMD:'wsadmin'})) {call setWasType('WSP',lastCommand()) debug ' Inside WSP module, collecting the WSADMIN start scripts' pretoc '2:WSADMIN Start Scripts' var $ABBR{'IBM WebSphere','$TOP'} = $WSP_TOP call sort_results(3,0,$WSP_TOP,'$TOP',\ grepDir(catDir($WSADMIN_DIR,'bin'),'.','p')) unpretoc debug ' Inside WSP module, listing the WSADMIN command files' var $dir = catDir($WSADMIN_DIR,'wsadmin') report wsadmin_cmd_list prefix {write '---+ List of WSADMIN Command Files' write '---## Information Taken from ',encode($dir) } call statFile('b',grepDir($dir,'\.py$','p')) if isCreated(true) toc '2:[[',getFile(),'][rda_report][WSADMIN Command Files List]]' break } } =head1 PROFILES COLLECTIONS It performs the following collections on all specified profiles/cells. =cut # Collect the data for each cell loop $c_itm (@CELLS) {# Cell variables var ($pro,$cel) = split(':',$c_itm) var $top = catDir($PROFILE_ROOT,$pro) var $ABBR{$c_itm,'$PROFILE_HOME'} = $top # Determine the related nodes var @nod = keys($NODES{$c_itm}) # Determine the related servers var @srv = keys($SERVERS{$c_itm}) =head2 Start Scripts Gathers IBM WebSphere Application Server-related start scripts. =cut debug ' Inside WSP module, analyzing profile:cell ',$c_itm if isTocCreated() toc '%SPLIT%' toc "1+:'",$pro,"/",$cel,"' Profile/Cell" debug ' - Inside WSP module, collecting the start scripts' pretoc '2:Start Scripts' call sort_results(3,0,$top,'$PROFILE_HOME',grepDir(catDir($top,'bin'),'.','p')) unpretoc =head2 JRF Configuration Gathers Java Required Files (JRF)-related configuration information. =cut debug ' - Inside WSP module, checking JRF configuration' report concat('p_',$pro,'_c_',$cel,'_jrf_config') prefix write '---+ JRF Configuration Information' loop $itm (@srv) {var (undef,undef,$nod,$srv) = split(':',$itm) var $fil = catFile(\ $top,'config','cells',$cel,'nodes',$nod,'servers',$srv,'server.xml') if ?testFile('fr',$fil) {var $obj = xmlLoadFile($fil,xmlDisable(xmlParser(),'BCDEPR')) if xmlFind($obj,'process:Server/customServices') {var ($xml) = last var $nam = xmlValue($xml,'classname') var $flg = xmlValue($xml,'enable') if and(compare('eq',$nam,'oracle.jrf.was.WebSphereJRFCustomService'),\ compare('eq',$flg,'true')) write " * '**",$srv,"**' server is configured with JRF." else {write " * '**",$srv,"**' server is not configured with JRF." var $NO_JRF = true } } } } if $NO_JRF write 'Note: Use ``applyJRF`` WSADMIN command to configure JRF.%BR%' if isCreated(true) toc '2:[[',getFile(),'][rda_report][JRF Configuration]]' =head1 CONFIGURATION FILES Gathers profile/cell-wide IBM WebSphere Application Server-related configuration files. =cut debug ' - Inside WSP module, collecting the configuration files' pretoc '%SPLIT%' pretoc '1++:Configuration Files' # Gather files from CELL_HOME pretoc '1+++:Cell Home' var ($dir,@tbl) = (catDir($top,'config','cells',$cel)) call get_conf(\@tbl,catDir($dir,'fmwconfig')) call get_conf(\@tbl,catDir($dir,'oracle')) var $ABBR{$c_itm,'$CELL_HOME'} = $dir call sort_results(2,0,$dir,'$CELL_HOME',\ catFile($dir,'cell.xml'),\ catFile($dir,'resources.xml'),\ catFile($dir,'security.xml'),\ catFile($dir,'variables.xml'),\ catFile($dir,'virtualhosts.xml'),\ @tbl) unpretoc # Gather files from NODES pretoc '%SPLIT%' pretoc '1+++:Nodes' var $ABBR{$c_itm,'$NODE_HOME'} = catDir($dir,'nodes') loop $itm (@nod) {var (undef,undef,$nod) = split(':',$itm) pretoc "2:'",$nod,"' Node" var @tbl = () call get_conf(\@tbl,catDir($ABBR{$c_itm,'$NODE_HOME'},$nod,'oracle')) call sort_results(3,0,$ABBR{$c_itm,'$NODE_HOME'},'$NODE_HOME',\ catFile($ABBR{$c_itm,'$NODE_HOME'},$nod,'node.xml'),\ catFile($ABBR{$c_itm,'$NODE_HOME'},$nod,'resources.xml'),\ catFile($ABBR{$c_itm,'$NODE_HOME'},$nod,'serverindex.xml'),\ catFile($ABBR{$c_itm,'$NODE_HOME'},$nod,'variables.xml'),\ @tbl) unpretoc } unpretoc 2 # Gather files from SERVERS pretoc '%SPLIT%' pretoc '1+++:Servers' loop $itm (@srv) {var (undef,undef,$nod,$srv) = split(':',$itm) pretoc "2:'",$srv,"' Server" var @tbl = () var $dir = catDir($ABBR{$c_itm,'$NODE_HOME'},$nod,'servers') call get_conf(\@tbl,catDir($dir,$srv,'fmwconfig')) call sort_results(3,0,$ABBR{$c_itm,'$NODE_HOME'},'$NODE_HOME',\ catFile($dir,$srv,'resources.xml'),\ catFile($dir,$srv,'server.xml'),\ @tbl) unpretoc } unpretoc 4 =head1 LOG FILES Gathers profile/cell-wide IBM WebSphere Application Server-related log files. =head2 Files from Latest Incidents Gathers files generated by the latest incidents. =cut pretoc '%SPLIT%' pretoc '1++:Log Files' # Gather files generated by the latest incidents if $INCIDENT_FILES {debug ' - Inside WSP module, collecting the latest incidents files' pretoc '2:Files from Latest Incidents' var $n_h = 0 loop $itm (@srv) {var (undef,undef,undef,$srv) = split(':',$itm) var $bas = catDir($top,'logs',$srv,'adr') loop $hom (findDir([$bas,catDir('diag','ofm')],'incident','rw',2)) {pretoc '3:From ',$hom var $lnk = concat("'",$srv,"' Server") var $rpt = concat('p_',$pro,'_c_',$cel,'_i',incr($n_h),'_',$srv) call write_latest_incidents($bas,$hom,$rpt,$lnk,3) unpretoc } } unpretoc } =head2 Local Log Files Gathers Oracle Forms, Oracle Reports, Oracle WebLogic Communication Services (OWLCS), and IBM WebSphere Application Server-related log files. =cut debug ' - Inside WSP module, collecting the local log files' pretoc '2:Local Log Files' var $dir = catDir($top,'logs') call sort_results(3,$TAIL,$top,'$PROFILE_HOME',grepDir($dir,'\.log$','ip')) loop $itm (@srv) {var (undef,undef,undef,$srv) = split(':',$itm) pretoc "3:'",$srv,"' Server" var ($sub,@tbl) = (catDir($dir,$srv)) call push(@tbl,grepDir($sub,'^System(Err|Out)\.log$','ip')) call get_app_log(\@tbl,$sub,'formsapp','formsapp-diagnostic\.log$','ip') call get_app_log(\@tbl,$sub,'reports','_diagnostic\.log$') call get_app_log(\@tbl,$sub,'sdp') call get_app_log(\@tbl,$sub,'wlcs') call get_app_log(\@tbl,$sub,'wsp',\ concat(verbatim($srv),'-diagnostic\.log$'),'ip') call sort_results(4,$TAIL,$top,'$PROFILE_HOME',@tbl) unpretoc } unpretoc 3 =head1 APPLICATIONS Gathers profile/cell-wide IBM WebSphere Application Server-related configuration and log files. =head2 Configuration Files Gathers profile/cell-wide IBM WebSphere Application Server application-related configuration files. =cut debug ' - Inside WSP module, collecting the application config files' pretoc '%SPLIT%' pretoc '1++:Applications' pretoc '2:Configuration Files' var ($dir,@tbl) = (catDir($top,'installedApps',$cel)) loop $app (grepDir($dir,'^\.+$','nv')) {loop $nam (grepDir(catDir($dir,$app),'\.war$','in')) call push(@tbl,catFile($dir,$app,$nam,'WEB-INF','web.xml')) } call sort_results(3,0,$top,'$PROFILE_HOME',@tbl) unpretoc 3 =head1 WSADMIN COLLECTIONS Collects IBM WebSphere Application Server run-time-related information. It requires the availability of IBM WebSphere Application Server Administration Tool (WSADMIN). =cut # Get the runtime information using WSADMIN run OFM:WSPrun($SERVERS{$c_itm},$NODES{$c_itm},$top,$c_itm,$LOGINS{$c_itm}) } # Write the RDA variables used write {$map} '---+ RDA Collection Shortcuts' prefix $map write {$map} '|*Section*|*Shortcuts*|' loop $key (keys(%ABBR)) {var ($tbl,@tbl) = ($ABBR{$key}) loop $abr (keys($tbl)) call push(@tbl,concat($abr,'%NEXT%',$tbl->{$abr})) write {$map} '|',replace($key,':','/'),\ ' |%TBL%%ID:symbol:value%',join('%BR%',@tbl),'%ENDTBL%|' } if !$map->is_created(true) write {$map} 'No shortcuts used' end $map unpretoc =head1 SEE ALSO L, L =begin credits =over 10 =item RDA 4.20: Greg Cook, Andrew Salt. =item RDA 8.08: Steve Andrew, Ingrid Govaerts. =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