# S340OID.def: Collects Oracle Internet Directory Information # $Id: S340OID.def,v 1.19 2008/01/17 11:40:39 mschenke Exp $ # ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/S340OID.def,v 1.19 2008/01/17 11:40:39 mschenke Exp $ # # Change History # 20080116 DEM Check if database information is not to be collected. =head1 NAME S340OID - Collects Oracle Internet Directory Information =head1 DESCRIPTION This module collects Oracle Internet Directory-related information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing Oracle Internet Directory module ...',tput('off') # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $LDAP_HOME = catDir($ORACLE_HOME,'ldap') var $OID_LOCAL = getSetting('OID_LOCAL') var $OID_USER = 'ODS' var $TAIL = getSetting('RDA_TAIL',1000) var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:Oracle Internet Directory' # Load the common macros run library() run DBinfo() # Change the database context if $OID_LOCAL var $sid = getSetting('ORACLE_SID') elsif getSetting('OID_SID') var $sid = trim(last,'-') if $sid {# Determine the user password if hasSqlPassword($OID_USER,$sid) var $pwd = undef else var $pwd = askPassword(concat('Enter ',$OID_USER,'@',$sid,' user password:')) # Switch the context var $log = setSqlLogin($OID_USER,$pwd,$sid) var $try = setSqlFailure(0) # Test the database connection if !testSql() var $DB_ACCESS = true } else {# Disable the database access var $log = setSqlLogin('','') var $try = setSqlFailure(-1) } =head2 oid_diag - OIDDIAG Output Displays the output of the F command. =cut debug ' Inside the OID Module: OIDDIAG command' if getSetting('OID_DIAG') {if findCommand('oiddiag') {var $cmd = last var $tmp = getTemp('oid','.txt') output P,concat($cmd,' collect_all=true >',quote($tmp,'x')) write getSetting('OID_DB_HOST') write getSetting('OID_DB_PORT') write getSetting('OID_SERVICE_NAME') write $pwd close report oid_diag prefix {write '---+!! OIDDIAG Command Output' write '---## Using: ',$cmd,' collect_all=true' } if grepFile($tmp,'^Done\! the output file is\s+(.*)\s*$') {var ($lin) = chomp(last) if match($lin,'^Done\! the output file is\s+(.*?)\s*$') call writeFile(last) } else call writeFile($tmp) call unlinkTemp('oid') if isCreated(true) toc '2:[[',getFile(),'][rda_report][OIDDIAG Output]]' } } =head2 process - Processes Displays the information about processes. =cut debug ' Inside the OID Module, gathering information about processes' report process var $TTL = '---+!! Processes' if isUnix() {var $OSP = testCommand('ps -ef','/bin/ps -ef','/usr/bin/ps -ef') prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ OID Processes' write '' } loop $lin (grepCommand($OSP,'oid')) write $lin if hasOutput(true) {write '' write $TOP } prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ DIP Processes' write '' } loop $lin (grepCommand($OSP,'odi')) write $lin if hasOutput(true) {write '' write $TOP } } if isWindows() var $fil = catFile($ORACLE_HOME,'opmn','bin','opmnctl.exe') else var $fil = catFile($ORACLE_HOME,'opmn','bin','opmnctl') if testFile('x',$fil) {var $cmd = concat($fil,' status') prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ ',$cmd } call writeCommand($cmd) if hasOutput(true) write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Processes]]' var $TTL = undef =head2 ods_process - ODS_PROCESS Information Lists details from C table. =cut if $DB_ACCESS {var $ver = get_db_version(true) debug ' Inside OID module, gathering details from ods_process table' report ods_process prefix {write '---+!! ODS_PROCESS' write $hdr } if match($ver,'^9') {var $hdr = '| *Instance*| *Process ID*| *Server ID*|*Flags*|*Hostname*| \ *ConfigSet*| *State*|*Last Wake Time*| *Retry Count*|' set $sql {SELECT '| ' || " instance || '| ' || " pid || '| ' || " serverid || '|' || " flags || ' |' || " hostname || ' | ' || " configset || '| ' || " state || '|' || " TO_CHAR(lastwaketime,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " retrycount || '|' " FROM ods_process; } } else {var $hdr = '| *Instance*| *Process ID*| *Server ID*|*Flags*|*Hostname*| \ *ConfigSet*| *State*|*Last Wake Time*| *Retry Count*|\ *Failed Host*|' set $sql {SELECT '| ' || " instance || '| ' || " pid || '| ' || " serverid || '|' || " flags || ' |' || " hostname || ' | ' || " configset || '| ' || " state || '|' || " TO_CHAR(lastwaketime,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " retrycount || '|' || " NVL(failedhost,'%NULL%') || ' |' " FROM ods_process; } } call writeSql($sql) if getSqlMessage() write last if isCreated(true) toc '2:[[',getFile(),'][rda_report][ODS_PROCESS Information]]' =head2 attrstore - Configsets Information Lists details from C table. =cut debug ' Inside OID module, gathering details from ds_attrstore table' report attrstore prefix {write '---+!! Configsets' write '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|' } set $sql {SELECT '| ' || " entryid || '|' || " attrname || ' |' || " attrval || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' " FROM ds_attrstore " WHERE entryid IN (SELECT entryid " FROM ds_attrstore " WHERE attrval LIKE '%osdldapd%' " AND attrval LIKE '%configset%'); } call writeSql($sql) if getSqlMessage() write last if isCreated(true) toc '2:[[',getFile(),'][rda_report][Configsets Information]]' } # Collect log files related to Oracle Internet Directory var $dir = catDir($LDAP_HOME,'log') pretoc '2:Config and Log Files' =head2 oidmon.log Displays the last lines of the monitor log. =cut debug ' Inside OID module, tail the monitor log' loop $nam (grepDir($dir,'oidmon\.log','in')) call tail_report($dir,$nam,$TAIL) =head2 oidldapd.log Displays the last lines of the LDAP log. =cut debug ' Inside OID module, tail the LDAP logs' loop $nam (grepDir($dir,'oidldapd.*\.log','in')) call tail_report($dir,$nam,$TAIL) =head2 oidrepld.log Displays the last lines of the replication log. =cut debug ' Inside OID module, tail the replication logs' loop $nam (grepDir($dir,'oidrepld.*\.log','in')) call tail_report($dir,$nam,$TAIL) =head2 $OH/ldap/odi/log Displays the contents of the files in the F<$ORACLE_HOME/ldap/odi/log> directory. =cut debug ' Inside the OID Module: Listing the files in $OH/ldap/odi/log directory' call sort_files(3,$TAIL,grepDir(catDir($LDAP_HOME,'odi','log'),'.','p')) =head2 odiprop - $OH/ldap/odi/conf/odi.properties Displays the contents of the F<$OH/ldap/odi/conf/odi.properties> file. =cut debug ' Inside the OID Module: Displaying the file\ $OH/ldap/odi/conf/odi.properties' var $dir = catDir($ORACLE_HOME,'ldap','odi','conf') var $fil = catFile($dir,'odi.properties') if testFile('r',$fil) {report odiprop write '---+!! Contents of ',$fil if !writeFile($fil) {write '**',$fil,' not readable.**%BR%\ May be file permission problems.%BR%\ Permissions are:%BR%' call statFile('b',$fil) write 'User: ',id(),'%BR%' } toc '3:[[',getFile(),'][rda_report][$OH/ldap/odi/conf/odi.properties]]' } =head2 $OH/ldap/load Displays the contents of the files in the F<$ORACLE_HOME/ldap/load> directory. =cut debug ' Inside the OID Module: Listing the files in $OH/ldap/load directory' call sort_files(3,$TAIL,grepDir(catDir($LDAP_HOME,'load'),'.','p')) =head2 $OH/ldap/das Displays the contents of the files in the F<$ORACLE_HOME/ldap/das> directory except for the F file. =cut debug ' Inside the OID Module: Listing the files in $OH/ldap/das directory' call sort_files(3,$TAIL,grepDir(catDir($LDAP_HOME,'das'),'^oiddas\.ear$','vip')) # Close the table of content section unpretoc =head2 not_found - Not found Used as a warning when none of the Oracle Internet Directory files are found. =cut if !isTocCreated() {debug ' Inside OID module, no file found' report not_found write 'No Oracle Internet Directory configuration files were found and all \ files were optional. This does not mean there was necessarily a \ problem with RDA, but it should be investigated.' toc '2:[[',getFile(),'][rda_report][Not found]]' } # Restore the previous context call setSqlLogin($log) call setSqlFailure($try) =begin credits =over 10 =item RDA 4.4: Wes Root. =item RDA 4.9: Irina Donaldson, Anita Hegde, Satheesan Vettahil. =back =end credits =head1 SEE ALSO See also L. =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