# S250BEE.def: Collects Beehive Information # $Id: S250BEE.def,v 1.10 2008/02/14 16:47:09 mschenke Exp $ # ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/S250BEE.def,v 1.10 2008/02/14 16:47:09 mschenke Exp $ # # Change History # 20080214 MSC Fix credits. =head1 NAME S250BEE - Collects Beehive Information =head1 DESCRIPTION This module collects the Beehive-related information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing BEE module ...',tput('off') # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $TAIL = getSetting('BEE_TAIL',5000) var $AGE = getSetting('BEE_LOG_AGE',5) var $OH = quote($ORACLE_HOME) var $OH2 = concat('^',$OH,'\b') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:Beehive' # Load common macros run library() =head2 beectl_status - C Gathers C output. =head2 beectl_version - C Gathers C output. =cut pretoc '2:beectl' if testFile('d',catDir($ORACLE_HOME,'beehive','bin')) {var $pgm = catCommand(lastDir(),'beectl') debug ' Inside BEE module, getting beectl status information' report beectl_status write '---+ beectl status' var $cmd = concat($pgm,' status 2>&1') write '---## Using: ',$cmd call writeCommand($cmd) toc '3:[[',getFile(),'][rda_report][beectl status]]' debug ' Inside BEE module, getting beectl version information' report beectl_version write '---+ beectl version' var $cmd = concat($pgm,' version 2>&1') write '---## Using: ',$cmd call writeCommand($cmd) toc '3:[[',getFile(),'][rda_report][beectl version]]' } unpretoc =head2 opmnctl_status - C Gathers C information. =cut debug ' Inside BEE module, getting opmnctl status information' report opmnctl_status write '---+ opmnctl status' var $cmd = concat(catCommand($ORACLE_HOME,'opmn','bin','opmnctl'),\ ' status -l 2>&1') write '---## Using: ',$cmd call writeCommand($cmd) toc '2:[[',getFile(),'][rda_report][opmnctl status]]' =head2 Log Files Gathers most recent log files in the following directory structures: =over 4 =item o F<$ORACLE_HOME/beehive/logs> =item o F<$ORACLE_HOME/clone/logs> =item o F<$ORACLE_HOME/install> =item o F<$ORACLE_HOME/opmn/logs> =back =cut macro get_logs {var ($dir,$pat) = @arg import $cnt,$AGE,$OH2,$TAIL,$TOC,$TOP keep $cnt,$AGE,$OH2,$TAIL,$TOC,$TOP # Analyze the directory var $ref = time() decr $ref,expr('*',$AGE,86400) loop $fil (grepDir($dir,$pat,'n')) {var $pth = catFile($dir,$fil) if match($fil,'^(\d{1,2})\.(\d{1,2})\.(\d{4})$') {var @tbl = last if match($dir,'\bBeehiveCoreConfiguration$',true) var $log{$pth} = sprintf("%04d%02d%02d",$tbl[2],$tbl[0],$tbl[1]) else {var $cur = mktime(59,59,23,$tbl[1],expr('-',$tbl[0],1),$tbl[2]) if expr('>',$cur,$ref) var $log{$pth} = sprintf("%04d%02d%02d",$tbl[2],$tbl[0],$tbl[1]) } } elsif testDir('d',$pth) {var $sub{$pth} = 1 } elsif testDir('f',$pth) {next and(isOlder($pth,$AGE),\ not(match($fil,'^(BeehiveCoreConfiguration_|schema_install\.log\.)',true))) if getSize($pth) {var $nam = replace($fil,\ '((_\d{2}){3}|\.\d{4}(-\d{2}){2}[_T]\d{2}(-\d{2}){2}(\.\d+)?)') var $nam{$nam} = $fil } } else next var @fil = (@fil,$pth) } # Report analysis results if @fil {# Display the directory content report concat('dir',$dir) write '---+!! Directory ',$dir write ' * Limited to files not older than ',$AGE,' days' write ' * Empty files are not collected.' call statFile('b',@fil) write $TOP toc '3:[[',getFile(),'][rda_report][',replace($dir,$OH2,'$OH'),']]' # Collect individual files loop $key (keys(%nam)) {incr $cnt var $fil = $nam{$key} report concat('log',$cnt,$fil) if match($fil,'schema_install\.log\.',true) call cat_file($dir,$fil) else call tail_file($dir,$fil,$TAIL) toc '4:[[',getFile(),'][rda_report][',$fil,']]' } # Treat the sub directories loop $sub (keys(%log,'ND')) call get_logs($sub,$pat) loop $sub (keys(%sub)) call get_logs($sub,$pat) } } # Get the log directories var %dir = ('Beehive', catDir($ORACLE_HOME,'beehive','logs'),\ 'Clone', catDir($ORACLE_HOME,'clone','logs'),\ 'Install', catDir($ORACLE_HOME,'install'),\ 'OPMN', catDir($ORACLE_HOME,'opmn','logs')) var %pat = ('Beehive', '[^\.]',\ 'Clone', '[^\.]',\ 'Install', '\.log$',\ 'OPMN', '[^\.]') var $cnt = 0 loop $typ (keys(%dir)) {next !testDir('dr',$dir{$typ}) debug ' Inside BEE module, about to gather ',$typ,' log files' toc '2:',$typ,' Log Files' call get_logs($dir{$typ},$pat{$typ}) } unpretoc =head1 SEE ALSO See also L. =begin credits =over 10 =item RDA 4.10: Frederic Daurelle. =item RDA 4.11: Frederic Daurelle, Andras Kecskes. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002-2008, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut