# OIDinfo.ctl: Collects Generic Oracle Internet Directory Information # $Id: OIDinfo.ctl,v 1.14 2015/05/29 07:48:00 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/OIDinfo.ctl,v 1.14 2015/05/29 07:48:00 RDA Exp $ # # Change History # 20150526 KRA Improve the documentation. =head1 NAME OFM:OIDinfo - Collects Generic Oracle Internet Directory Information =head1 DESCRIPTION This module collects generic Oracle Internet Directory information. =cut # Initialization var ($AS11,$INS) = @arg import $LDAP_HOME,$ORACLE_HOME,$TOC,$TOP # Collect the database information if or(and($AS11,$INS),not($AS11)) {# Load the common macros run DB:DBinfo() # Set the database context if ${GRP.OID.I_DB} {call setSqlTarget(last) var ($typ,$sid,$usr) = getSqlInfo() # Test the database connection if testSql() {echo '' echo tput('bold'),'The schema containing the OID repository is not \ accessible.',tput('off') echo tput('bold'),'Therefore RDA cannot collect repository information.',\ tput('off') if getSqlMessage() echo last echo '' } else var $DB_ACCESS = true } else var $DB_ACCESS = false =head2 oid_diag - OIDDIAG Output Displays the output of the F command. =cut if ${GRP.OID.B_DIAG} {if ?findCommand('oiddiag') var $cmd = last elsif grepDir(catDir($LDAP_HOME,'bin'),'oiddiag','fip') var $cmd = catCommand(last) else var $cmd = undef if ?$cmd {var $tmp = getTemp('oid','.txt') var $out = getTemp('oiddiag','.txt') debug ' Inside OID module, executing the OIDDIAG command' output | concat($cmd,' collect_all=true outfile=',$out,' >',$tmp) write ${GRP.OID.T_HOST} write ${GRP.OID.N_PORT} write ${GRP.OID.T_SERVICE_NAME} call writePassword("%s\012",$typ,$sid,$usr,\ "Enter '${VAR.usr}' at '${VAR.sid}' user password for collecting \ oiddiag command output:",'') if $AS11 {write 'N' write 'N' } close report oid_diag prefix {write '---+!! OIDDIAG Command Output' write '---## Using: ',encode($cmd),' collect_all=true' } if grepFile($tmp,'^Done! the output file is\s+(.*?)\s*$','f1') call writeFile(last) else call writeFile($tmp) call unlinkTemp('oid') call unlinkTemp('oiddiag') if isCreated(true) toc '2:[[',getFile(),'][rda_report][OIDDIAG Output]]' } } } =head2 oidctl - OIDCTL Status Displays the C status. =cut if or(and($AS11,not($INS)),not($AS11)) {var $chk = true if ?findCommand('oidctl') {var $cmd = concat(last,' connect=',quote($sid),' status 2>&1') debug ' Inside OID module, getting the OIDCTL status' report oidctl prefix {write '---+!! OIDCTL Status' write '---## Using: ',encode($cmd) } if loadCommand($cmd) {call writeLastFile() var $chk = false } if isCreated(true) toc '2:[[',getFile(),'][rda_report][OIDCTL Status]]' } =for stopwords ldapcheck =head2 ldapcheck - ldapcheck Displays the output of the command C<$ORACLE_HOME/ldap/bin/ldapcheck> when it encounters a problem for getting the C status. =cut if $chk {if ?testFile('f',$fil = \ catFile($ORACLE_HOME,'ldap','bin',${AS.EXE:'ldapcheck'})) {debug ' Inside OID module, getting the ldapcheck command output' report ldapcheck prefix {write '---+!! ldapcheck command output' write '---## Using: ',encode($fil) } if loadCommand(lastTestCommand()) call writeLastFile() if isCreated(true) toc '2:[[',getFile(),'][rda_report][ldapcheck]]' } } =head2 replication_info - Replication Information Displays the output of the commands C<$ORACLE_HOME/ldap/bin/remtool -pverify> and C<$ORACLE_HOME/ldap/bin/remtool -asrverify -v>. =cut if ?$pgm = testFile('f',catFile($ORACLE_HOME,'ldap','bin',${AS.EXE:'remtool'})) {debug ' Inside OID module, getting the replication information' report replication_info title '---+!! Replication Information' title $TOC # Gather LDAP replication information var $cmd = concat($pgm,' -pverify') prefix {write '---+ LDAP Replication' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP # Gather ASR replication information var $cmd = concat($pgm,' -asrverify -v') prefix {write '---+ ASR Replication' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP if isCreated(true) toc '2:[[',getFile(),'][rda_report][Replication Information]]' } =head2 process - Processes Displays the information about processes. For Windows, RDA gets the processes only if the F command is available. =cut debug ' Inside OID module, gathering information about processes' report process title '---+!! Processes' title $TOC if isUnix() {if loadCommand(testCommand('ps -ef','/bin/ps -ef','/usr/bin/ps -ef')) {prefix {write '---+ OID Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('\boid\w')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ DIP Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('\b(odi\w|wls_ods1)')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ OVD Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('\bvde')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ WebLogic Server Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('-Dweblogic')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ Java Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('\bjava')) write $lin if hasOutput(true) {call endBlock() write $TOP } } } elsif or(isWindows(),isCygwin()) {if ?findCommand('tasklist') {if loadCommand(concat(last,' /V')) {prefix {write '---+ OID Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('^oid','i')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ DIP Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('^(odi|wls_ods1)','i')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ OVD Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('^vde','i')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ WebLogic Server Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('^weblogic','i')) write $lin if hasOutput(true) {call endBlock() write $TOP } prefix {write '---+ Java Processes' call beginBlock(true) write getHeader() } loop $lin (grepLastFile('^java','i')) write $lin if hasOutput(true) {call endBlock() write $TOP } } } } if !$AS11 {if ?testFile('f',catFile($ORACLE_HOME,'opmn','bin',${AS.EXE:'opmnctl'})) {var $cmd = concat(lastTestCommand(),' status') prefix write '---+ ',encode($cmd) call writeCommand($cmd) if hasOutput(true) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Processes]]' } =head2 db_version - Database Version Information Gathers the database version information. =cut if or(and($AS11,$INS),not($AS11)) {if $DB_ACCESS {debug ' Inside OID module, gathering database version information' report db_version prefix {write '---+!! Database Version Information' write '| *Version*|' } set $sql {SELECT '| ' || " version || '|' " FROM product_component_version " WHERE product LIKE 'Oracle%'; } call writeSql($sql) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Database Version Information]]' =head2 ods_process - ODS Process Information Lists details from the C table on OID 11g, or from the C table in earlier versions. =cut debug ' Inside OID module, gathering ODS process information' report ods_process prefix {write '---+!! ',uc($tbl) write $hdr } if $AS11 var ($tbl,$flg) = ('ods_process_status',true) else {var ($tbl,$flg) = ('ods_process',\ getSqlColumns('RDA','','ODS_PROCESS','failedhost')) call clearSqlColumns('RDA') } if $flg {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 :1; } } else {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 :1; } } call writeSql(bindSql($sql,$tbl)) if getSqlMessage() write last if isCreated(true) toc '2:[[',getFile(),'][rda_report][ODS Process Information]]' =head2 attrstore - DS_ATTRSTORE table Information Lists details from C table. =cut debug ' Inside OID module, gathering details from ds_attrstore table' report attrstore var $TTL = '---+!! DS_ATTRSTORE Table Information' var @TTL = ('',\ '---+ Default LDAP Settings',\ '---+ Other LDAP Settings',\ '---+ Default Replication Settings',\ '---+ Other Replication Settings',\ '---+ DIP Information - Profile Information',\ '---+ DIP Information - Default Profiles',\ '---+ DIP Information - DIP Configuration') var @HDR = ('',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|') set $sql {SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=configset0,' || " '%cn=osdldapd,' || " '%cn=subconfigsubentry%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(2)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(REPLACE(attrval,'%','%'), " CHR(10),'%BR%'), " '|','|') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=osdldapd,%cn=subconfigsubentry%' " AND attrval NOT LIKE '%cn=configset0,%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(3)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=configset0,' || " '%cn=osdrepld,' || " '%cn=subconfigsubentry%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(4)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=osdrepld,%cn=subconfigsubentry%' " AND attrval NOT LIKE '%cn=configset0,%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(5)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=metadird,' || " '%cn=configsets,' || " '%cn=oracle internet directory%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(6)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=provisioning profiles,' || " '%cn=changelog subscriber,' || " '%cn=oracle internet directory%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(7)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=odi,%cn=oracle internet directory%') " ORDER BY entryid,attrname; "PROMPT ___Capture_Only_Config___ } if $AS11 {append $sql {SELECT 'port=' || attrval " FROM ds_attrstore " WHERE attrname = 'orclnonsslport' " AND entryid IN (SELECT entryid " FROM ds_attrstore " WHERE attrname = 'orcloidcomponentname'); } } else {append $sql {SELECT 'port=' || attrval " FROM ds_attrstore " WHERE attrname = 'orclnonsslport'; } } call separator(1) call writeSql($sql) call separator(0,'DS_ATTRSTORE Table Information') var $prt = isPort(value(grepSqlBuffer('Config','^port=','f')),true) } =head2 oidconf - OID Configuration Performs LDAP queries to get OID configuration information. =cut debug ' Inside OID module, getting the OID configuration information' var $flg = false if grepCommand(\ concat(catCommand($ORACLE_HOME,'bin','ldapsearch'),' -H 2>&1'),'\s-q\s','f') var ($flg,$pgm) = (true,lastCommand()) if !$flg var $pgm = findCommand('ldapsearch') if and(defined($pgm),$prt) {var $ADMIN = 'orcladmin' var $PSEUDO = 'OFM:OID' var $PWD = ['host',$PSEUDO,$ADMIN,"Enter '${VAR.ADMIN}' user password:",''] # Macro to get the output of ldapsearch command macro exec_ldapsearch {var ($cmd,$ttl,$flg) = @arg import $ADMIN,$PSEUDO,$PWD,$TOP keep $ADMIN,$PSEUDO,$PWD,$TOP prefix write '---+ ',$ttl if $flg {suspend report var $out = getTemp('ldapsearch','.txt') var $cmd = concat($cmd,' >',$out,' 2>&1') output | $cmd call writePassword("%s\012",\ 'host',$PSEUDO,$ADMIN,"Enter '${VAR.ADMIN}' user password:",'') close resume report call writeFile($out,['C','ldapsearch']) call unlinkTemp('ldapsearch') } else call writeCommand({cmd => concat($cmd,' 2>&1'),pwd => $PWD}) if hasOutput(true) write $TOP } report oidconf title '---+!! OID Configuration Information using LDAP Queries' title $TOC var $cmd = concat($pgm,' -p ',$prt,' -D cn=orcladmin ',\ cond($flg,'-q','-w %s'),\ ' -L -b "" -s sub "objectclass=pwdpolicy"') call exec_ldapsearch($cmd,'Password Policy Configuration',$flg) var $cmd = concat($pgm,' -p ',$prt,' -D cn=orcladmin ',\ cond($flg,'-q','-w %s'),\ ' -L -b "cn=plugin,cn=subconfigsubentry" -s sub \ "objectclass=*"') call exec_ldapsearch($cmd,'Plug-in Configuration',$flg) var $cmd = concat($pgm,' -p ',$prt,' -D cn=orcladmin ',\ cond($flg,'-q','-w %s'),\ ' -L -b "cn=replication configuration" -s sub \ "objectclass=*"') call exec_ldapsearch($cmd,'Replication Agreement Configuration',$flg) var $cmd = concat($pgm,' -p ',$prt,' -D cn=orcladmin ',\ cond($flg,'-q','-w %s'),\ ' -b "cn=subscriber profile,cn=changelog subscriber,\ cn=oracle internet directory" -s sub "objectclass=*"') call exec_ldapsearch($cmd,'DIP Profile Configuration',$flg) var $cmd = concat($pgm,' -p ',$prt,' -D cn=orcladmin ',\ cond($flg,'-q','-w %s'),\ ' -L -b "cn=Profiles,cn=Provisioning,\ cn=Directory Integration Platform,cn=Products,\ cn=OracleContext" -s sub "objectclass=*"') call exec_ldapsearch($cmd,'DIP Provisioning Profiles Configuration',$flg) if isCreated(true) toc '2:[[',getFile(),'][rda_report][OID Configuration]]' } } =for stopwords conf ldap =head2 odiprop - $OH/ldap/odi/conf/odi.properties Displays the contents of the F<$ORACLE_HOME/ldap/odi/conf/odi.properties> file. =cut if or(and($AS11,not($INS)),not($AS11)) {pretoc '2:Configuration and Log Files' debug ' Inside OID module, displaying the file \ $OH/ldap/odi/conf/odi.properties' var $fil = catFile($ORACLE_HOME,'ldap','odi','conf','odi.properties') if ?testFile('r',$fil) {report odiprop write '---+!! Contents of ',encode($fil) if !writeFile($fil) {write '**',encode($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]]' } # End the section for 11g only if $AS11 unpretoc } =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.4: Wes Root. =item RDA 4.9: Irina Donaldson, Anita Hegde, Satheesan Vettahil. =item RDA 4.12: Raju Channabasappa, Wes Root, Jerry Smith, Satheesan Vettahil. =item RDA 4.15: Greg Cook, Wes Root, Andrew Salt, Ram Sathyanarayan, Hector Viveros. =item RDA 4.22: Hector Viveros. =item RDA 4.24: Ralf Sahlmen. =item RDA 8.03: Christopher Hearne. =item RDA 8.04: Hector Viveros. =back =end credits =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