# MCend.ctl:999:Finalizes the Explorer Data Collection # $Id: MCend.ctl,v 1.8 2015/01/22 09:02:59 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCend.ctl,v 1.8 2015/01/22 09:02:59 RDA Exp $ # # Change History # 20150119 PRA Improve portability. =head1 NAME EXPLORER:MCend - Finalizes the Explorer Data Collection =over 2 =cut use Explorer use Mrc # Make the module persistent # Initialization var @COMMON_SECTIONS = ('XPLR_end') var @ROOT_SECTIONS = ('XPLR_defaults') var $VALIDATE = true keep $VALIDATE,@COMMON_SECTIONS,@ROOT_SECTIONS section begin run EXPLORER:XPLRlib('end') #------------------------------------------------------------------------------ # XPLR_end section #------------------------------------------------------------------------------ section XPLR_end call log_run('Processing END sections ...') var ${RUN.EXPLORER.XPLR.END.G_END/T} = time() var $rpt = cond(${SET.EXPLORER.XPLR.BEGIN.B_FILTER:true},'D','B') =item o Produces the Oracle Explorer F file. =cut var $DOMAINNAME = ${CMD.DOMAINNAME:'domainname'} var $HOSTID = ${CMD.HOSTID:'hostid'} var $HOSTNAME = ${CMD.HOSTNAME:'hostname'} debug ' Inside END collection, generating the README file' call $[OUT]->add_report($rpt,'END_readme',false,'.dat',true,1) call beginBlock(false) call addBlock('E','D','README') call addBlock('L',1) write '=========== ORACLE EXPLORER DATA COLLECTOR (Version ',${RDA.V_VERSION},\ ') ===========' if ?testFile('x','/usr/bin/showrev') {var (undef,$lvl) = split('\s+',command('/usr/bin/showrev -p 2>/dev/null'),3) write '=========== Patch level: ',$lvl,' ===========' } write write 'This directory contains system configuration information.' write 'Information was gathered on ',localtime('%a %b %d %H:%M:%S %Z %Y'),'.' write write 'Synopsis' write '========' write write ' Customer Name: ',${SET.EXPLORER.XPLR.BEGIN.T_CUSTOMER_NAME} write ' Contract ID: ',${SET.EXPLORER.XPLR.BEGIN.T_CONTRACT_ID} if length($str = ${SET.EXPLORER.XPLR.BEGIN.T_REPLY}) write ' Email results to: ',$str if length($str = ${RUN.EXPLORER.XPLR.BEGIN.T_RECEIPT}) write 'Explorer receipts to: ',$str if length($str = ${SET.EXPLORER.XPLR.BEGIN.T_NOTIFY}) write ' Email on data load: ',$str write ' Modules selected: ',join(',',@{W_MODULES}) if length($str = ${RUN.EXPLORER.XPLR.BEGIN.T_COMMAND}) write ' Command Line: ',$str if length($srl = ${SET.EXPLORER.XPLR.BEGIN.T_SR:\ ${RUN.EXPLORER.XPLR.BEGIN.T_SR}}) write ' Service Request: ',$srl if length($esc = ${SET.EXPLORER.XPLR.BEGIN.T_ESCALATION:\ ${RUN.EXPLORER.XPLR.BEGIN.T_ESCALATION}}) write ' Escalation number: ',$esc write ' Explorer_Type: ',cond(length($srl),'REACTIVE',\ length($esc),'REACTIVE',\ 'PROACTIVE') if length($str = ${SET.EXPLORER.XPLR.BEGIN.T_LICENSE}) write ' License Agreement: ',$str if $[XPL]->get_sets('sc') write ' SC extended data for: ',join(' ',last) var $lst = join(', ',$[XPL]->get_sets('disks/t3')) if $[XPL]->get_sets('disks/t3') write ' T3 extended data for: ',join(' ',last) if $[XPL]->get_sets('san') write ' SAN switch extended data for: ',join(' ',last) write write ' User Name: ',${SET.EXPLORER.XPLR.BEGIN.T_USER_NAME} write ' User e-mail: ',${SET.EXPLORER.XPLR.BEGIN.T_USER_EMAIL} write ' User Phone #: ',${SET.EXPLORER.XPLR.BEGIN.T_PHONE} write write 'System Serial number: ',${SET.EXPLORER.XPLR.BEGIN.T_SERIAL} write ' Address line 1: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_1} write ' Address line 2: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_2} write ' City: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_CITY} write ' State: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_STATE} write ' Country: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_COUNTRY} write ' Zip Code: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_ZIP} write ' Country Code: ',${SET.EXPLORER.XPLR.BEGIN.T_ADDRESS_COUNTRY_CODE} write write 'The following info was collected using UNIX tools \ (hostname, arch, etc)' write '------------------------------------------------- \ ---------------------' write write 'Date: ',localtime('%Y.%m.%d.%H.%M',${RUN.EXPLORER.XPLR.END.G_BEGIN}) write 'Finished: ',localtime('%Y.%m.%d.%H.%M',${RUN.EXPLORER.XPLR.END.G_END}) write 'Hostname: ',command(concat($HOSTNAME,' 2>/dev/null')) write 'Hostid: ',command(concat($HOSTID,' 2>/dev/null')) write 'Release: ',uname('r') write 'Kernel architecture: ',uname('m') write 'Application architecture: ',get_arc() write 'Domain: ',command(concat($DOMAINNAME,' 2>/dev/null')) write 'Kernel version: ',\ replace(join(' ',uname('s'),uname('r'),uname('v')),'_',' ',true) if expr('>=',get_osv(),11) write 'Entire Version : ',\ grepCommand('/usr/bin/pkg list -H entire','\s+([\.\-\d]+)','f1') if ${OS.solaris} {if compare('eq',get_arc(),'sparc') write 'System Type: ',\ nvl(first(grepCommand('/usr/sbin/prtconf','^SUNW,','f')),\ first(grepCommand('/usr/sbin/prtconf','^CYRS,','f'))) else {if ?$cmd = nvl(testFile('x','/usr/sbin/smbios'),\ testFile('x','/sbin/smbios'),\ testFile('x','/usr/bin/smbios')) {var (undef,$typ) = split(':',\ grepCommand(concat($cmd,' 2>/dev/null'),'Product','f')) write 'System Type: ',$typ } } write 'Uptime: ',command('/usr/bin/uptime 2>/dev/null') write join("\012",'Swap-s:',command('/usr/sbin/swap -s 2>/dev/null')) write join("\012",'Swap-l:',command('/usr/sbin/swap -l 2>/dev/null')) } else {write 'Uptime: ',command('/usr/bin/uptime 2>/dev/null') write 'Swap:' if createBuffer('SWAP','R','/proc/swaps') {while ?getLine('SWAP') write chomp(last) call deleteBuffer('SWAP') } } write join("\012",'Vmstat:',command('/usr/bin/vmstat 2>/dev/null')) call endBlock(false) =item o Records the collector revision. =cut debug ' Inside END collection, recording the collector revision' write "\012Revision:" call beginBlock(false) call addBlock('E','D','rev') call addBlock('L',0) write ${RDA.V_VERSION} call endBlock() end =item o Collects the Oracle Explorer defaults file. =cut section XPLR_defaults debug ' Inside END collection, collecting the defaults file' if ${RUN.EXPLORER.XPLR.BEGIN.F_DEFAULT} var $fil = ${RUN.EXPLORER.XPLR.BEGIN.F_DEFAULT} elsif ?${RUN.EXPLORER.D_ETC} var $fil = catFile(last,'default','explorer') elsif ?${ENV.EXP_CONFIG} var $fil = catFile(last,'default','explorer') elsif and(${OS.solaris},expr('<',get_osv(),11)) var $fil = '/etc/opt/SUNWexplo/default/explorer' else var $fil = '/etc/explorer/default/explorer' if ?testFile('f',$fil) {call $[OUT]->add_report($rpt,'END_defaults',false) prefix call addBlock('E','D','defaults') call addBlock('L',2) call writeFile($fil) end } =back =head1 SEE ALSO L, L, L =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