# M268SAP.def: Collects SAP Installation Information # $Id: M268SAP.def,v 1.2 2012/08/10 17:39:48 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M268SAP.def,v 1.2 2012/08/10 17:39:48 mschenke Exp $ # # Change History # 20120810 PRA Fix uname remote query. =head1 NAME M268SAP - Collects SAP Installation Information =head1 DESCRIPTION This module collects SAP installation 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('sap') #------------------------------------------------------------------------------ # XPLR_sap section #------------------------------------------------------------------------------ section XPLR_sap # Validate the execution context if !${OS.solaris} return call log_run('Processing SAP sections ...') if and(${XPLR_GLOBAL:true},not(${XPLR_LOCAL:false}),\ not(testDir('d','/usr/sap'))) return log_info('SAP not installed') pretoc '2:SAP Installations' =head2 Commands Gathers SAP installations information using the following commands: =over 2 =item o C =item o C =item o C =item o C =item o C&1\"> =item o C =item o C =item o C =item o C =item o C&1\"> =item o C =item o C =item o C =item o C =back =cut loop $zon (get_zones(false)) {if defined($nam = $zon->[0]) {var ($ttl,$pre,$exe) = (concat('From Zone ',$nam),\ concat('zones/',$nam),\ concat('/usr/sbin/zlogin ',$nam)) var ($chk) = grepCommand(concat($exe,' /usr/bin/ls -d /usr/sap 2>/dev/null'),\ '.*','c') next !$chk } else {next !testDir('d','/usr/sap') var ($nam,$ttl,$pre,$exe) = ('global','From Global Zone') } call log_info(concat('sap: RUNNING: zone ',$nam),\ concat(' Inside SAP collection, collecting commands from ',\ $nam,' zone (can take time)')) var ($top,@cmd,@fil) = ($zon->[1]) call push(@fil,\ ['B','sap/tp/DOMAIN.CFG','/usr/sap/trans/bin/DOMAIN.CFG'],\ ['B','sap/tp/TP_QAD.PFL','/usr/sap/trans/bin/TP_QAD.PFL']) loop $sys (grepDir(catDir($top,'/usr/sap'),'^[A-Z][0-9A-Z][0-9A-Z]$','n')) {var $dir = catDir('/usr/sap',$sys) var $ora = concat('ora',lc($sys)) var $usr = concat(lc($sys),'adm') if ?$exe var ($hst) = command(join(' ',$exe,'/usr/bin/uname -n')) else var $hst = uname('n') # Determine what to collect if $hom = value(grepCommand(\ join(' ',$exe,'/bin/su','-',$ora,'-c','/usr/bin/env'),'^ORACLE_HOME=')) call push(@fil,\ ['B',join('/','sap',$sys,'ora',concat('init',$sys,'.ora')),\ catFile($hom,'dbs',concat('init',$sys,'.ora'))],\ ['B',join('/','sap',$sys,'ora',concat('init',$sys,'.sap')),\ catFile($hom,'dbs',concat('init',$sys,'.sap'))]) call push(@cmd,\ {cmd => 'TITLE',\ txt => concat('---+ ',$sys,' SAP System')}) if ?$exe call push(@cmd,\ [join('/','sap',$sys,'ipclimits'),\ '/bin/sh',concat('-c "',\ catFile($dir,'SYS/exe/run/ipclimits'),' 2>&1"'),\ '---++ Available System Resources']) else call push(@cmd,\ [join('/','sap',$sys,'ipclimits'),\ '/bin/su',concat('- ',$usr,' -c "/bin/sh -c ',\ catFile($dir,'SYS/exe/run/ipclimits'),' 2>&1"'),\ '---++ Available System Resources']) if testDir('d',catDir($top,$dir,'/SYS/profile')) {call push(@cmd,\ [join('/','sap',$sys,'profiledir_listing'),\ '/bin/ls',concat('-al ',catDir($dir,'/SYS/profile')),\ concat('---++ Contents of Directory ',catDir($dir,'/SYS/profile'))]) call push(@fil,\ ['B',join('/','sap',$sys,'DEFAULT.PFL'),\ catFile($dir,'/SYS/profile/DEFAULT.PFL')]) } if ?$exe call push(@cmd,\ [join('/','sap',$sys,'disp+work'),\ '/usr/bin/file',catFile($dir,'SYS/exe/run/disp+work'),\ concat('---++ File Type for ',\ catFile($dir,'SYS/exe/run/disp+work'))]) else call push(@cmd,\ [join('/','sap',$sys,'disp+work'),\ '/bin/su',concat('- ',$usr,' -c "/usr/bin/file ',\ catFile($dir,'SYS/exe/run/disp+work'),'"'),\ concat('---++ File Type for ',\ catFile($dir,'/SYS/exe/run/disp+work'))]) loop $ins (grepDir(catDir($top,$dir),'^[A-Z]','n')) {next match($ins,'SYS') call push(@cmd,\ {cmd => 'TITLE',\ txt => concat('---++ Instance ',$ins)},\ [join('/','sap',$sys,$ins,'workdir_listing'),\ '/bin/ls',concat('-al ',catDir($dir,$ins,'/work')),\ concat('---+++ Contents of Directory ',catDir($dir,$ins,'/work'))]) if ?$exe call push(@cmd,\ [join('/','sap',$sys,$ins,'sapparar-all'),\ catCommand($dir,'SYS/exe/run/sapparar'),\ concat('name=',$sys,' pf=',catFile($dir,'SYS/profile',\ concat($sys,'_',$ins,'_',uname('n'))),' all'),\ '---+++ Profile Information']) else call push(@cmd,\ [join('/','sap',$sys,$ins,'sapparar-all'),\ '/bin/su',\ concat('- ',$usr,' -c "',catFile($dir,'SYS/exe/run/sapparar'),\ ' name=',$sys,' pf=',\ catFile($dir,'SYS/profile',concat($sys,'_',$ins,'_',$hst)),\ ' all"'),\ '---+++ Profile Information']) call push(@cmd,{cmd => 'UNTITLE'}) loop $fil (grepDir(catDir($top,$dir,'SYS/profile'),\ concat('(',$sys,'|START)_',$ins,'_'),'n')) call push(@fil,\ ['B',join('/','sap',$sys,$ins,$fil),catFile($dir,'SYS/profile',$fil)]) } if ?$exe call push(@cmd,\ [join('/','sap',$sys,'disp+work-v'),\ catCommand($dir,'SYS/exe/run/disp+work'),'-v',\ '---++ Release Level'],\ [join('/','sap',$sys,'saposcol-v'),\ catCommand($dir,'SYS/exe/run/saposcol'),'-v',\ '---++ Version of SAPOSCOL'],\ {cmd => 'UNTITLE'}) else call push(@cmd,\ [join('/','sap',$sys,'disp+work-v'),\ '/bin/su',concat('- ',$usr,' -c "',\ catCommand($dir,'SYS/exe/run/disp+work'),' -v"'),\ '---++ Release Level'],\ [join('/','sap',$sys,'saposcol-v'),\ '/bin/su',concat('- ',$usr,' -c "',\ catCommand($dir,'SYS/exe/run/saposcol'),' -v"'),\ '---++ Version of SAPOSCOL'],\ {cmd => 'UNTITLE'}) } # Produce the report pretoc '3:',$ttl report concat('sap_z_',$nam,'_cmd') title '---+!! ',concat('Commands ',$ttl) title $TOC call do_remote($pre,$exe,$top,@cmd) if isCreated(true) toc '4:[[',getFile(),'][rda_report][Commands]]' =head2 Files Gathers the following SAP installation files: =over 2 =item o F =item o F =item o F =item o F =item o F =item o F<${ORA_HOME}/dbs/init${SAP_SYS}.ora> =item o F<${ORA_HOME}/dbs/init${SAP_SYS}.sap> =back =cut debug ' Inside SAP collection, collecting files from ',$nam,\ ' zone (can take time)' report concat('sap_z_',$nam,'_fil') prefix {write '---+!! Files ',$ttl write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_rem($pre,$top,@fil) if isCreated(true) {write $TOP toc '4:[[',getFile(),'][rda_report][Files]]' } # Adjust the table of content unpretoc } # Adjust the table of content unpretoc =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