# S220IA.def: Collects Intelligent Agent Information # $Id: S220IA.def,v 1.28 2009/01/14 10:43:24 ldens Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/S220IA.def,v 1.28 2009/01/14 10:43:24 ldens Exp $ # # Change History # 20090114 LDE Change the copyright notice. =head1 NAME S220IA - Collects Intelligent Agent Information =head1 DESCRIPTION This module collects the Intelligent Agent information. This module only applies to versions earlier than Oracle Database 10g. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing Intelligent Agent module ...',tput('off') # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $TAIL = getSetting('RDA_TAIL',1000) pretoc '1:Intelligent Agent' # Load the common macros run library() =head2 Configuration Files Collects all files related to Intelligent Agent. =cut debug ' Inside IA module, about to gather IA files' pretoc '2:Configuration Files' var $dir = getEnv('TNS_ADMIN',catDir($ORACLE_HOME,'network','admin')) loop $fil (grepDir($dir,'^snmp.*\.ora$','in')) call cat_report($dir,$fil) if isVms() call cat_report($dir,'oratab.ora') call cat_report(catDir($ORACLE_HOME,'network','agent'),'services.ora') call cat_report(catDir($ORACLE_HOME,'network','agent'),'dbsnmp.ver') call cat_report(catDir($ORACLE_HOME,'network','agent','config'),'nmxw.ora') call cat_report(catDir($ORACLE_HOME,'network','agent','config'),'oapps.ora') call cat_report(catDir($ORACLE_HOME,'network','trace'),'dbsnmp.nohup') var $ref = catFile($ORACLE_HOME,'network','admin','snmp_rw.ora') if testFile('r',$ref) {var $dir = catDir($ORACLE_HOME,'network','log') if value(grepFile($ref,'^dbsnmp\.trace_directory','fi')) var $dir = last loop $fil (grepDir($dir,'.','t')) {next match($fil,'^\.{1,2}$') break } loop $str (grepFile($ref,'^dbsnmp\.trace_file','i')) {next match($str,'dbsnmp\.trace_filecnt',true) break } if value($str) var $fil = last call cat_report($dir,$fil) } unpretoc if !isTocCreated() echo 'No Oracle Intelligent Agent found in use on this Oracle Home' =head2 Log files Collects last lines of log files. =cut debug ' Inside IA module, about to gather log files' pretoc '2:Log Files' var $dir = catDir($ORACLE_HOME,'network','log') loop $nam (grepDir($dir,'^(agent|dbsnmp|nmi)','in')) call tail_report($dir,$nam,$TAIL) unpretoc =head2 status - Intelligent Agent Status Gets the Intelligent Agent status. From Oracle 9i on, F is no longer the interface to IA and is replaced by F. There may not be a database available on this system, so Oracle cannot guarantee the version information from the database. Therefore, RDA checks to see if F exists; if it exists, then it is used. Otherwise, RDA uses F. C can hang, thus causing the script to hang. To prevent this, the command execution is limited to 30 seconds when C is supported in the Perl version. =cut debug ' Inside IA module, do status of Intelligent Agent' echo 'Processing Intelligent Agent status' report status if isVms() {write '---+!! Intelligent Agent Status Information' write $TOC # Check the account can do a show process var ($prv) = command(concat('write sys$output f$privilege("WORLD")')) var $prv = match($prv,'TRUE',true) # Get AGENTWORK process information write '---+ AGENTWORK Process' prefix write '' loop $lin (grepCommand('show system','ORA_AGENTWORK','i')) {var $pid = field('\s+',0,$lin) write $lin } if hasOutput(true) {write '' if $prv call writeCommand(concat('show process/identification=',$pid)) else write 'IA WORK process found, but could not issue the SHOW PROCESS command \ due to lack of privileges.%BR%' } else write 'IA WORK process not found.%BR%' write $TOP # Get ORACOMM process information write '---+ COMM Process' prefix write '' loop $lin (grepCommand('show system','ORACOMM','i')) {var $pid = field('\s+',0,$lin) write $lin } if hasOutput(true) {write '' if $prv call writeCommand(concat('show process/identification=',$pid)) else write 'IA COMM process found, but could not issue the SHOW PROCESS command \ due to lack of privileges.%BR%' } else write 'IA COMM process not found.%BR%' write $TOP # Get IA Status if loadCommand('agentctl status') {write '---+ AGENTCTL STATUS' call writeLastFile() write $TOP } elsif loadCommand('lsnrctl dbsnmp_status') # 8.1 {write '---+ LSNRCTL DBSNMP_STATUS' call writeLastFile() write $TOP } } else {prefix write '---+!! Status of the Intelligent Agent' var $err = 0 if grepDir(catDir($ORACLE_HOME,'bin'),'^agentctl(\.exe)?$','i') {var $agt = 1 var $ret = loadCommand('agentctl status',true) } else {var $agt = 0 var $ret = loadCommand('lsnrctl dbsnmp_status',true) var $err = grepLastFile('undefined command "dbsnmp_status"') } if $err unprefix elsif $ret call writeLastFile() elsif statCommand() {echo ' Status Check for Intelligent Agent timed out' write 'Could not get Intelligent Agent status, command did not complete.%BR%\ Status Check for Intelligent Agent cancelled.' } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Intelligent Agent Status]]' =head2 processes - dbsnmp Process Status Checks for the existence of the dbsnmp process. =cut # Determine if the agent is running if $agt var $run = grepLastFile('^Agent is running') else var $run = grepLastFile('subagent is already running') # If it is, we want to check for the existence of the dbsnmp process if $run {debug ' Inside IA module, get dbsnmp process' report processes var $TTL = '---+ Associated Intelligent Agent Process Data' # Get the ps command format var $PS_EF run &{check(getOsName(),'aix', 'OSaix',\ 'darwin', 'OSdarwin',\ 'dec_osf', 'OSosf',\ 'dynixptx', 'OSptx',\ 'hpux', 'OShpux',\ 'linux', 'OSlinux',\ 'solaris', 'OSsunos',\ cond(isUnix(), 'OSunix'))}('PS') # Grep the processes prefix {write $TTL write '' } if loadCommand($PS_EF) {loop $lin (getLines(0,0),grepLastFile('dbsnmp','i')) write $lin } if hasOutput(true) write '' else {write $TTL write 'dbsnmp process not found.' } toc '2:[[',getFile(),'][rda_report][dbsnmp Process Status]]' } =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002-2009, 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