# S484ASAP.def: Collects Oracle Communications ASAP Information # $Id: S484ASAP.def,v 2.11 2012/01/03 13:34:47 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/S484ASAP.def,v 2.11 2012/01/03 13:34:47 mschenke Exp $ # # Change History # 20120103 MSC Change the copyright notice. =head1 NAME S484ASAP - Collect Oracle Communications ASAP Software Information =head1 DESCRIPTION This module collects Oracle Communications ASAP-related information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing ASAP module ...',tput('off') # Initialization var $ASAP_DOMAIN = getSetting('ASAP_DOMAIN','') var $ASAP_HOME = getSetting('ASAP_HOME','') var $ASAP_LIMIT = getSetting('ASAP_LIMIT',5000) var $ASAP_SHELL = getSetting('ASAP_SHELL') var $ASAP_VOLUME = getSetting('ASAP_VOLUME',25) var $TAIL = getSetting('ASAP_TAIL',5000) var $TOC = '%TOC%' var $TOC2 = '%TOC2%' var $TOP = '[[#Top][Back to top]]' toc '1:ASAP' # Define the database separator macro macro separator {var $cur = $arg[0] import $TOC,$TOP,$TTL,@DBG,@HDR,@TTL,@TXT keep $cur,$sep,$TOC,$TOP,$TTL,@DBG,@HDR,@TTL,@TXT if $cur {if hasOutput(true) write $TOP var $sep = $cur if $DBG[$sep] debug $DBG[$sep] prefix {if !isCreated() {write $TTL write $TOC } if $TTL[$sep] write $TTL[$sep] if $TXT[$sep] write $TXT[$sep],'%BR% ' if $HDR[$sep] write $HDR[$sep] } return 1 } if getSqlMessage() write last,'%BR%' if hasOutput(true) write $TOP if isCreated() toc nvl($arg[2],2),':[[',getFile(),'][rda_report][',$arg[1],']]' } macro separator2 {var $cur = $arg[0] import $TOC,$TOP,$TTL,@DBG,@HDR,@TTL,@TXT keep $cur,$sep,$TOC,$TOP,$TTL,@DBG,@HDR,@TTL,@TXT if $cur {if hasOutput(true) {write '' write $TOP } var $sep = $cur if $DBG[$sep] debug $DBG[$sep] prefix {if !isCreated() {write $TTL write $TOC } if $TTL[$sep] write $TTL[$sep] if $TXT[$sep] write $TXT[$sep],'%BR% ' if $HDR[$sep] write $HDR[$sep] write '' } return 1 } if getSqlMessage() write last,'%BR%' if hasOutput(true) {write '' write $TOP } if isCreated() toc nvl($arg[2],2),':[[',getFile(),'][rda_report][',$arg[1],']]' } # Define the directory analysis macro macro stat_tree {var ($dir) = @arg import $TOP prefix { } call statDir('n',$dir) if hasOutput(true) write $TOP loop $pth (grepDir($dir,'^\.+$','npv')) {if testFile('dr',$pth) {next testFile('l',$pth) call stat_tree($pth) } } } # Source the profile call backupEnv('asap') call source(catCommand($ASAP_HOME,'Environment_Profile'),true,$ASAP_SHELL) if !getEnv('ASAP_BASE') {call restoreEnv('asap') echo tput('bold'),'Application environment must be set up before running \ this script, execute source $ASAP_HOME/Environment_Profile first',\ tput('off') return } =head2 product_info - Product Information Collects a variety of Oracle Communications ASAP product information. =cut debug ' Inside ASAP module, getting product information' report product_info write '---+!! Application Information' write $TOC var $cmd = catCommand(getEnv('SCRIPTS'),'status') prefix {write '---++ ASAP Applications Running' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP var $dir = getEnv('PROGRAMS') var $cmd = concat(catCommand($dir, 'sarm'),' -i') prefix {write '---++ sarm' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat(catCommand($dir, 'ctrl_svr'),' -i') prefix {write '---++ ctrl_svr' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat(catCommand($dir, 'fork_agent'),' -i') prefix {write '---++ fork_agent' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat(catCommand($dir, 'admn_svr'),' -i') prefix {write '---++ admn_svr' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat(catCommand($dir, 'asc_nep'),' -i') prefix {write '---++ asc_nep' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP var $cmd = concat(catCommand($dir, 'srp_emul'),' -i') prefix {write '---++ srp_emul' write '---### Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP toc '2:[[',getFile(),'][rda_report][Product Information]]' =head2 environment_profile - Environment Profile Reports the environment profile. =cut debug ' Inside ASAP module, getting the environment profile' report environment_profile var $fil = catFile($ASAP_HOME,'Environment_Profile') prefix {write '---+ Oracle Communications ASAP Environment Profile' write '---## From: ',encode($fil) } call writeFile($fil) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Environment Profile]]' =head2 properties - ASAP.Properties File Reports Oracle Communications ASAP properties. =cut debug ' Inside ASAP module, getting property information' report properties var $fil = catFile($ASAP_HOME,'ASAP.properties') prefix {write '---+ Oracle Communications ASAP Properties File' write '---## From: ',encode($fil) } call writeFile($fil) if isCreated(true) toc '2:[[',getFile(),'][rda_report][ASAP.Properties File]]' =head2 configs - Configuration Files Collects Oracle Communications ASAP configuration files. =cut debug ' Inside ASAP module, getting configuration information' report configs var $dir = getEnv('ASAP_CFG') prefix {write '---+!! Oracle Communications ASAP Configuration Files' write '---## Recursively Searched from ',encode($dir) write $TOC2 } loop $fil (grepDir($dir,'^\.+$','drv')) {if testFile('fT',$fil) {write '---' write '---+',encode($fil) call writeFile($fil) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Configuration Files]]' =head2 misc_files - Miscellaneous Files Collects miscellaneous Oracle Communications ASAP files. =cut debug ' Inside ASAP module, getting miscellaneous files' report misc_files prefix {write '---+!! Miscellaneous Oracle Communications ASAP Files' write $TOC2 } var $dir = catDir(getEnv('ORBIX_BASE'),'config','Repositories','ImpRep') loop $fil (catFile($ASAP_HOME,'.profile'),\ catFile(getEnv('ASAP_CFG'),'ASAP.cfg'),\ catFile(getEnv('PROGRAMS'),'JInterpreter'),\ catFile(getEnv('SYBASE'),'interfaces'),\ catFile(getEnv('ORACLE_HOME'),'network','admin','tnsnames.ora'),\ grepDir($dir,'imp$','dr')) {if testFile('fT',$fil) {write '---' write '---+',encode($fil) call writeFile($fil) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Miscellaneous Files]]' =head2 core_file_analysis - Product Information Analyzes core files. =cut debug ' Inside ASAP module, analyzing core files' report core_file_analysis prefix {write '---+!! Core Files' write '---## Recursively Searched from ',encode($ASAP_HOME) write $TOC } loop $fil (grepDir($ASAP_HOME,'core','dr')) {if testFile('fB',$fil) {write '---+',encode($fil) call writeCommand(concat('pstack ',$fil)) } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Core Files]]' =head2 install_info - Installation Files Collects Oracle Communications ASAP installation files. =cut debug ' Inside ASAP module, getting installation files' report install_info var $dir = catDir($ASAP_HOME,'install') prefix {write '---+ Oracle Communications ASAP Installation Information' write '---## Recursively Searched from ',encode($dir) write $TOC2 } loop $fil (grepDir($dir,'^\.+$','drv')) {if testFile('fT',$fil) {write '---' write '---+',encode($fil) call writeFile($fil) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Installation Files]]' =head2 log_files - Log Files Collects Oracle Communications ASAP log files. =cut debug ' Inside ASAP module, getting log files' report log_files prefix {write '---+!! Oracle Communications ASAP Log Files' write '---## Recursively from ',encode($ASAP_HOME) write $TOC2 } loop $fil (grepDir($ASAP_HOME,'log$','dr')) {if testFile('fT',$fil) {write '---+ ',encode($fil) write '---## (',getSize($fil),' bytes)' call writeTail($fil,$TAIL) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Log Files]]' =head2 script_files - Script Files Collects Oracle Communications ASAP script files. =cut debug ' Inside ASAP module, getting script files' report script_files var $dir = catDir($ASAP_HOME,'scripts') prefix {write '---+!! Oracle Communications ASAP Script Files' write '---## Recursively from ',encode($dir) write $TOC2 } loop $fil (grepDir($dir,'.*','dr')) {if testFile('fT',$fil) {write '---+ ',encode($fil) write '---## (',getSize($fil),' bytes)' call writeFile($fil) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Script Files]]' =head2 diag_files - Diagnostic Files Collects Oracle Communications ASAP diagnostic files. =cut debug ' Inside ASAP module, getting diagnostic files (can take time)' report diag_files var $dir = getEnv('LOGDIR') prefix {write '---+!! Oracle Communications ASAP Diagnostic Files' write '---## Recursively from ',encode($dir) write ' * File size lower than ',$ASAP_VOLUME,' MB' write ' * 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.' write '%BR%' write '|*File Name*| *Size*|*Last Modification*|' } var $max = expr('*',1000000,$ASAP_VOLUME) loop $fil (grepDir($dir,'diag','tr')) {next !testFile('fT',$fil) var $lnk = encode($fil) decr $max,getSize($fil) if expr('>',$max,0) {output d,concat('diag_',basename($fil)) if ${CUR.LAST}->write_data($fil) var $lnk = concat('[[',${CUR.LAST}->get_file,'][_blank][',$lnk,']]') call $[OUT]->end_report(${CUR.LAST}) } write '|',$lnk,' | ',getSize($fil),'|',\ getLastModify($fil,'%d-%b-%Y %H:%M:%S'),' |' } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Diagnostic Files]]' =head2 object_files - Object Information Lists Oracle Communications ASAP object files. =cut debug ' Inside ASAP module, listing object information' report object_files var $objectDir = getEnv('OBJECT_DIRS') var $dir = catDir($ASAP_HOME,'objects') prefix {write '---+ Oracle Communications ASAP Object Information' write '---## Recursively Searched from ',encode($objectDir) } loop $fil (grepDir($objectDir,'^\.+$','drv')) write $fil,'%BR%' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Object Information]]' =head2 all_directories - ASAP Directory Listing Lists the content of the Oracle Communications ASAP directory structure. =cut debug ' Inside ASAP module, listing ASAP directory structure' report asap_directories write '---+ Oracle Communications ASAP Directory Structure Content' write '---## Recursively Searched from ',encode($ASAP_HOME) call stat_tree($ASAP_HOME) toc '2:[[',getFile(),'][rda_report][ASAP Directory Listing]]' =head2 domain_directories - Domain Directory Listing Lists the content of the domain. =cut debug ' Inside ASAP module, listing Domain directory structure' report domain_directory_listig write '---+ Adminserver Domain Listing' write '---## Recursively Searched from ',encode($ASAP_DOMAIN) call stat_tree($ASAP_DOMAIN) toc '2:[[',getFile(),'][rda_report][Domain Directory Listing]]' =head2 domain_logs - Domain Log Files Collects domain log files. =cut debug ' Inside ASAP module, getting domain log files' report domain_logs write '---+!! Domain Log Files (',$ASAP_LIMIT,' lines of each type)' write '---## From ',$ASAP_DOMAIN write $TOC loop $fil (grepDir($ASAP_DOMAIN,'log$','np')) {prefix {if isCreated() write '---' write '---+',encode($fil) } call writeTail($fil,$ASAP_LIMIT) if hasOutput(true) write $TOP } loop $dir (grepDir($ASAP_DOMAIN,'logs','dr')) {loop $log (grepDir($dir,'log$','dr')) {var $max = $ASAP_LIMIT loop $fil (grepDir(dirname($log),concat('^',quote(basename($log))),'tr')) {break expr('<=',$max,0) prefix {if isCreated() write '---' write '---+',encode($fil) } call writeTail($fil,$max) decr $max,getWriteLength() if hasOutput(true) write $TOP } } } toc '2:[[',getFile(),'][rda_report][Domain Log Files]]' =head2 control_db - Control Database Tables Lists the contents of several important control database tables. =cut debug ' Inside ASAP module, getting control database tables' report control_tables var $usr = getSetting('ASAP_CTRL_USER') var $sid = getSetting('ASAP_SID') # Determine the user/password if compare('eq',$usr,'/') var ($usr,$pwd) = ('','') elsif hasSqlPassword($usr,$sid) var $pwd = undef else var $pwd = askPassword(concat('Enter ',$usr,'@',$sid,' user password:')) # Change the database context var $old = setSqlLogin($usr,$pwd,$sid) var $try = setSqlFailure(0) # Perform the collection var $TTL = '---+!! Control Database' var @TTL = ('',\ '---+ TBL_SYSTEM_ALARM',\ '---+ TBL_APPL_PROC',\ '---+ TBL_CLASSA_SECU',\ '---+ TBL_CLASSB_SECU',\ '---+ TBL_CODE_LIST',\ '---+ TBL_COMPONENT',\ '---+ TBL_LISTENERS',\ '---+ TBL_PROCESS_INFO',\ '---+ TBL_SERVER_INFO') set $sql {SELECT * " FROM tbl_system_alarm " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(2)___ "SELECT * " FROM tbl_appl_proc " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(3)___ "SELECT * " FROM tbl_classa_secu " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(4)___ "SELECT * " FROM tbl_classb_secu " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(5)___ "SELECT * " FROM tbl_code_list " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(6)___ "SELECT * " FROM tbl_component " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(7)___ "SELECT * " FROM tbl_listeners " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(8)___ "SELECT * " FROM tbl_process_info " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(9)___ "SELECT * " FROM tbl_server_info " WHERE ROWNUM < 500; } call separator2(1) call writeSql($sql) call separator2(0,'Control Database Tables') =head2 sarm_db - Sarm Database Tables Lists the contents of several important Sarm database tables =cut debug ' Inside ASAP module, getting Sarm database information' report sarm_db var $usr = getSetting('ASAP_SARM_USER') # Determine the user/password if compare('eq',$usr,'/') var ($usr,$pwd) = ('','') elsif hasSqlPassword($usr,$sid) var $pwd = undef else var $pwd = askPassword(concat('Enter ',$usr,'@',$sid,' user password:')) # Change the database context call setSqlLogin($usr,$pwd,$sid) call setSqlFailure(0) # Perform the collection var $TTL = '---+!! Sarm Database' var @TTL = ('',\ '---+ TBL_ASAP_SRP',\ '---+ TBL_CLLI_ROUTE',\ '---+ TBL_COMM_PARAM',\ '---+ TBL_HOST_CLLI',\ '---+ TBL_ID_ROUTING',\ '---+ TBL_NEP',\ '---+ TBL_NEP_ADSL_PROG',\ '---+ TBL_NE_CONFIG',\ '---+ TBL_RESOURCE_POOL') set $sql {SELECT * " FROM tbl_asap_srp " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(2)___ "SELECT * " FROM tbl_clli_route " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(3)___ "SELECT * " FROM tbl_comm_param " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(4)___ "SELECT * " FROM tbl_host_clli " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(5)___ "SELECT * " FROM tbl_id_routing " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(6)___ "SELECT * " FROM tbl_nep " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(7)___ "SELECT * " FROM tbl_nep_adsl_prog " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(8)___ "SELECT * " FROM tbl_ne_config " WHERE ROWNUM < 500; "PROMPT ___Macro_separator2(9)___ "SELECT * " FROM tbl_resource_pool " WHERE ROWNUM < 500; } call separator2(1) call writeSql($sql) call separator2(0,'Sarm Database Tables') # Restore the database context call setSqlLogin($old) call setSqlFailure($try) # Restore the environment call restoreEnv('asap') =begin credits =over 10 =item RDA 4.13: Robert Finley =item RDA 4.19: Robert Finley =back =end credits =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