# M264JES.def: Collects Sun Java Enterprise System Information # $Id: M264JES.def,v 1.1 2012/08/13 07:00:03 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M264JES.def,v 1.1 2012/08/13 07:00:03 mschenke Exp $ # # Change History # 20120606 PRO Initial Version # =head1 NAME M264JES - Collects Sun Java Enterprise System Information =head1 DESCRIPTION Collects Sun Java Enterprise System information. The following reports can be generated and are regrouped under C: =cut use Mrc # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var $WRN = '* Links point to files that have been collected in their original \ format. Opening them directly in your browser can present risks. \ To prevent them, access the file outside the browser or use the \ link to save them and use an adequate viewer.' run XPLRlib('sunjes') # ----------------------------------------------------------------------------- # XPLR_sunjes section # ----------------------------------------------------------------------------- section XPLR_sunjes # Validate the execution context if !${XPLR_GLOBAL:true} return call log_run('Processing JES sections...') if expr('<',get_osv(),10) return log_info('The OS version must be 5.10 or later') if !testFile('f','/usr/bin/prodreg') return log_info('prodreg command not found or is not executable') call system('/usr/bin/prodreg browse -u "Java Enterprise System"') if !status() return log_info('Sun Java Enterprise System is not installed') # Get package-related information var %pkg = () if is_pkg_installed('SUNWasac') {var $pkg{'aps'} = {\ log => '/var/opt/SUNWappserver/domains',\ opt => 'nv',\ pat => '(^\.+$|admin-keyfile|admsn|domain-password|secure-seed|\.db)',\ pre => 'ApplicationServer',\ ttl => 'Application Server'} if ?get_pkg_base('SUNWasac') var $pkg{'aps','bas'} = last } if is_pkg_installed('SUNWics5') {var $pkg{'cal'} = {\ pre => 'CalendarServer',\ ttl => 'Calendar Server'} if ?$bas = get_pkg_base('SUNWics5') {var $pkg{'cal','bas'} = $bas if grepFile(catFile($bas,'ics.conf'),'logfile\.logdir\s*=','f') var $pkg{'cal','log'} = catDir(replace(value(last),'"','',true)) } } if is_pkg_installed('SUNWdsvu') {var $pkg{'dir'} = {\ opt => '',\ pat => '^dse\.ldif$',\ pre => 'DirectoryServer',\ ttl => 'Directory Server'} if grepFile('/etc/mps/admin/v5.2/shared/config/serverroot.conf','^.*$','f') var $pkg{'dir','bas'} = catDir(last) } if is_pkg_installed('SUNWps') {var $pkg{'por'} = {\ cfg => '/etc/opt/SUNWps',\ log => '/var/opt/SUNWps',\ opt => 'drv',\ pat => '^\.+$',\ pre => 'PortalServer',\ ttl => 'Portal Server'} if ?get_pkg_base('SUNWps') var $pkg{'aps','bas'} = last } var $pkg{'pro'} = {ttl => 'Product Registry'} if is_pkg_installed('SUNWproxy') {var $pkg{'prx'} = {\ opt => 'nv',\ pat => '(^\.+$|admpw)',\ pre => 'ProxyServer',\ ttl => 'Proxy Server'} if ?get_pkg_base('SUNWproxy') var $pkg{'aps','bas'} = last } if is_pkg_installed('SUNWiqu') var $pkg{'que'} = {ttl => 'Message Queue'} if is_pkg_installed('SUNWwbsvr') {var $pkg{'wbs'} = {\ opt => 'nv',\ pat => '(^\.+$|admpw)',\ pre => 'WebServer',\ ttl => 'Web Server'} if ?get_pkg_base('SUNWwbsvr') var $pkg{'aps','bas'} = last } =head1 COMMANDS =head2 jes_cmd - Commands Collects Java Enterprise System components information using the following commands: =over 2 =item o C =item o C =item o C<${ASAC_DIR}/appserver/bin/asadmin> =item o C =item o C =item o C<${PS_DIR}/bin/version> =item o C<${PROXY_DIR}/proxy-admserv/start -version> =item o C<${WBSRV_DIR}/https-admserv/start -version> =item o C =back Lists the contents of the following directories: =over 2 =item o F<${DSVU_DIR}/slapd*> =item o F<${PROXY_DIR}/proxy-*> =item o F<${WBSVR_DIR}/https-*> =item o F =back ${PKG_DIR} represents the base installation directory for each package: =over 2 =item o ${ASAC_DIR} holds the value for the C package =item o ${DSVU_DIR} holds the value for the C package =item o ${PS_DIR} holds the value for the C package =item o ${PROXY_DIR} holds the value for the C package =item o ${WBSVR_DIR} holds the value for the C package =back =cut pretoc '2: Java Enterprise System' var (%cmd,%ins) = () # Add Application Server commands if exists($pkg{'aps','bas'}) {var $bas = $pkg{'aps','bas'} if grepDir(catDir($bas,'domains'),'^\.+$','v') var $ins{'aps'} = {ins => [last],\ nam => 'sunjes/ApplicationServer/domains.out'} var $cmd{'aps'} = [\ ['sunjes/ApplicationServer/version',\ catFile($bas,'appserver','bin','asadmin'),'version',\ '---++ Version']] } # Add Calendar Server command if exists($pkg{'aps'}) {var $cmd{'cal'} = [\ ['sunjes/CalendarServer/version',\ '/usr/bin/pkgparam','SUNWics5 VERSION',\ '---++ Version']] var $ins{'cal','ins'} = [undef] } # Add Directory Server commands if exists($pkg{'dir'}) {if exists($pkg{'dir','bas'}) {if grepDir(catDir($pkg{'dir','bas'}),'slapd','dn') var $ins{'dir'} = {ins => [last],\ nam => 'sunjes/DirectoryServer/instances.out'} } var $cmd{'dir'} = [\ ['sunjes/DirectoryServer/version',\ '/usr/sbin/directoryserver','-listversions',\ '---++ Version']] } # Add Message Queue command if exists($pkg{'que'}) var $cmd{'que'} = [\ ['sunjes/MessageQueue/version',\ '/usr/bin/imqcmd','-v',\ '---++ Message Queue Version']] # Add Portal Server commands if exists($pkg{'por','bas'}) {var $bas = $pkg{'por','bas'} if grepDir($bas,'https\-','n') var $ins{'por','ins'} = [last] var $cmd{'por'} = [\ ['sunjes/PortalServer/version',\ catFile($bas,'SUNWps','bin','version'),undef,\ '---++ Version']] } # Add Product Registry commands var $cmd{'pro'} = [\ ['sunjes/prodreg_browse-u',\ '/usr/bin/prodreg','browse -u "Java Enterprise System"',\ '---++ Information'],\ ['sunjes/prodreg_info-u',\ '/usr/bin/prodreg','info -u "Java Enterprise System"',\ '---++ Attributes']] # Add Proxy Server commands if exists($pkg{'prx','bas'}) {var $bas = $pkg{'prx','bas'} if grepDir($bas,'proxy-','n') var $ins{'prx'} = {ins => [last],\ nam => 'sunjes/Webproxy/instances.out'} var $cmd{'prx'} = [\ ['sunjes/WebProxy/proxy-admserv/version',\ catFile($bas,'proxy-admserv','start'),'-version',\ '---++ Version']] } # Add Web Server commands if exists($pkg{'wbs','bas'}) {var $bas = $pkg{'wbs','bas'} if grepDir($bas,'https-','dn') var $ins{'wbs'} = {ins => [last],\ nam => 'sunjes/WebServer/instances.out'} var $cmd{'wbs'} = [\ ['sunjes/WebServer/https-admserv/version',\ catFile($bas,'https-admserv','start'),'-version',\ '---++ Version']] } # Generate the report report jes_cmd title '---++!! Java Enterprise System Information' title $TOC loop $key (keys(%cmd)) {debug ' Inside JES collection, gathering JES commands' # Collect the version commands for each product call do_exec(\ {cmd => 'TITLE',txt => concat('---+ ',$pkg->{'ttl'})},\ @{$cmd{$key}},\ {cmd => 'UNTITLE'}) # Collect the instance list for each product if exists($ins->{$key,'nam'}) {var @tbl = @{$ins->{$key,'ins'}} call do_exec({cmd => 'ARRAY',\ nam => $ins->{$key,'nam'},\ tbl => \@tbl,\ ttl => '---++ Instances'}) } } if isCreated(true) toc '3:[[',getFile(),'][rda_report][Commands]]' =head1 CONFIGURATION FILES =head2 jes_cfg_aps - Application Server Collects Application Server configuration files from the F directory. ${INS} represents each of the domains names for the Application Server>. It does not collect files with the C, C, C, C patterns or the C<.db> extension. =head2 jes_cfg_cal - Calendar Server Collects the following Calendar Server configuration files: =over 2 =item o F<${DIR}/counter.conf> =item o F<${DIR}/ics.conf> =item o F<${DIR}/version.conf> =back ${DIR} holds the base installation directory of the C package. =head2 jes_cfg_dsv - Directory Server Collects the following =item o F<${DIR}/userdb> (recursive) =back ${DIR} holds the contents of F file. ${INS} represents each of the instance names for Directory Server. =head2 jes_cfg_por - Portal Server Collects the following Portal Server configuration files: =over 2 =item o F =item o F =item o F =item o F =item o F (recursive) =back ${INS} represents each of the instance names of the Portal Server. =head2 jes_cfg_prx - Proxy Server Collects the following =item o F<${DIR}/userdb> (recursive) =back It does not collect the files with the F pattern. ${DIR} holds the base installation directory of the C package. ${INS} represents each of the instance names of the Proxy Server. =head2 jes_cfg_wbs - Web Server Collects the following Web Server configuration files: =over 2 =item o F<${DIR}/${INS}/config/*> =item o F<${DIR}/userdb> (recursive) =back Files with patterns F are not collected. ${DIR} holds the base installation directory of the C package. ${INS} represents each of the instance names of the Web Server. =cut pretoc '3: Configuration Files' loop $key (keys(%pkg)) {next missing($pkg{$key,'pre'}) var ($pre,$ttl) = ($pkg{$key,'pre'},$pkg{$key,'ttl'}) debug ' Inside JES collection, gathering ',$ttl,' configuration files' report concat('jes_cfg_',$key) title '---+!! ',$ttl,' Configuration Files' title $TOC title $WRN # Collect userdb data if and(match($key,'dir|prx|wbs'),\ exists($pkg{$key,'bas'}),\ testDir('d',$dir = catDir($pkg{$key,'bas'},'userdb'))) {prefix {write '---+ Userdb Files' write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_dir(join('/',$pre,'userdb'),$dir,'true') if hasOutput(true) write $TOP } # Collect Portal files if and(compare('eq',$key,'por'),\ testDir('d',catDir($dir = $pkg{'por','cfg'}))) {prefix {write '---+ Global Files' write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil(\ [join('/',$pre,$dir),$dir,'','','\.properties','n']) loop $sub ('desktop','portlet','wsrp') call do_collect_fil(\ [join('/',$pre,$dir,$sub),catDir($dir,$sub),'','','\.properties','n']) if hasOutput(true) write $TOP } # Collect product files if compare('eq',$key,'cal') {if and(exists($pkg{'cal','bas'}),testDir('d',$dir = $pkg{'cal','bas'})) {prefix {write '---+ Calendar Server Files' write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil(\ ['sunjes/CalendarServer/config/counter.conf',catFile($dir,'counter.conf')],\ ['sunjes/CalendarServer/config/ics.conf' ,catFile($dir,'ics.conf')],\ ['sunjes/CalendarServer/config/version.conf',catFile($dir,'version.conf')]) if hasOutput(true) write $TOP } } elsif and(exists($ins{$key,'ins'}),\ exists($pkg{$key,'bas'}),\ exists($pkg{$key,'pat'})) {var ($bas,$opt,$pat) = ($pkg{$key,'bas'},$pkg{$key,'opt'},$pkg{$key,'pat'}) # Collect files for each instance title '---+ Instances' loop $ins (@{$ins{$key,'ins'}}) {# Check the directory existence var $dir = check($key,'aps',catDir($bas,'domains',$ins,'config'),\ 'por',catDir($bas,$ins,'portal','config'),\ catDir($bas,$ins,'config')) next !testDir('d',$dir) # Collect the files when the directory is found prefix {write '---++ ',ucfirst($ins),' Files' write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil([join('/',$pre,$ins,'config'),$dir,'','',$pat,$opt]) if hasOutput(true) write $TOP } } # Add the report to the table of contents if isCreated(true) toc '4:[[',getFile(),'][rda_report][',$ttl,']]' } # Adjust the table of contents unpretoc =head1 LOG FILES =head2 jes_log_aps - Application Server For each domain, collects the latest 2000 lines of the Application Server log files from the F directory. =head2 jes_log_cal - Calendar Server Collects the latest 2000 lines of Calendar Server log files from the log directory. The log directory is obtained from the C parameter present in the F configuration file. =head2 jes_log_dsv - Directory Server For each instance, collects the latest 2000 lines of Directoy Server log files from the F<${DIR}/${INSTANCE}/logs> directory. ${DIR} holds the contents of the F configuration file. =head2 jes_log_por - Portal Server For each instance, collects the latest 2000 lines of Portal Server log files from the F directory. =head2 jes_log_prx - Proxy Server For each instance, collects the latest 2000 lines of Proxy Server log files from the F<${DIR}/${INSTANCE}/portal/logs> directory. ${DIR} holds the base installation directory of the C package. =head2 jes_log_wbs - Web Server For each instance, collects the latest 2000 lines of the Web Server log files from the F<${DIR}/${INSTANCE}/logs> directory. ${DIR} holds the base installation directory of the C package. ${INSTANCE} holds the instance name. =cut pretoc '3: Log Files' loop $key (keys(%ins)) {var ($pre,$ttl) = ($pkg{$key,'pre'},$pkg{$key,'ttl'}) debug ' Inside JES collection, gathering ',$ttl,' log files' report concat('jes_log_',$key) title '---+!! ',$ttl,' Log Files' title $TOC title $WRN if $flg = compare('ne',$key,'cal') title '---+ Instances' var $pat = check($key,'por','\.log$','^\.+$') var $opt = check($key,'por','np', 'npv') loop $ins (@{$ins{$key,'ins'}}) {var $dir = check($key,'aps',catDir($pkg{$key,'log'},$ins,'logs'),\ 'cal',$pkg{$key,'log'},\ 'por',catDir($pkg{$key,'log'},$ins,'portal','logs'),\ catDir($pkg{$key,'bas'},$ins,'logs')) next !testDir('d',$dir) # Collect the files when the directory is found prefix {if $flg write '---++ ',ucfirst($ins),' Files' write '|*File Path*| *Size*|*Last Modified Date*|' } loop $fil (grepDir($dir,$pat,$opt)) call do_collect_fil({cmd => 'TAIL',\ cnt => 2000,\ fil => $fil,\ nam => join('/',$pre,$ins,'logs',basename($fil))}) if hasOutput(true) write $TOP } if isCreated(true) toc '4:[[',getFile(),'][rda_report][',$ttl,']]' } # Adjust the table of contents unpretoc 2 =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut