# DCoud.ctl:343:Collects Oracle Unified Directory Information # $Id: DCoud.ctl,v 1.24 2014/12/03 15:17:59 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCoud.ctl,v 1.24 2014/12/03 15:17:59 RDA Exp $ # # Change History # 20141203 KRA Default N_TAIL setting to 1000. =head1 NAME OFM:DCoud - Collects Oracle Unified Directory Information =head1 DESCRIPTION This module collects information for Oracle Unified Directory. The following reports can be generated and are regrouped under C: =head1 REPORTS =cut echo tput('bold'),'Processing OFM.OUD module ...',tput('off') # Initialization var $ADMIN_PORT = isPort(${N_ADMIN_PORT},true) var $ADMIN_USER = quote(${T_ADMIN_USER:'admin'}) var $ADVANCED = ${B_ADVANCED:false} var $DIR_MANAGER = quote(${T_DIR_MANAGER:'cn=Directory Manager'}) var $HOST = isHost(${T_HOST:${RDA.T_HOST}},true) var $INSTANCE = ${D_INSTANCE:''} var $JDK_HOME = ${D_JDK:''} var $LDAP_PORT = isPort(${N_LDAP_PORT},true) var $LDAPS_PORT = isPort(${N_LDAPS_PORT},true) var $LOOP = ${N_LOOP:4} var $ORACLE_HOME = ${GRP.INIT.D_ORACLE_HOME/P:''} var $REPLICATION = ${B_REPLICATION:false} var $SLEEP = ${N_SLEEP:30} var $TAIL = ${N_TAIL:1000} if isUnix() var ($BIN,$MOD) = ('bin','fx') else var ($BIN,$MOD) = ('bat','fr') var $OUD = catDir($INSTANCE,'OUD') var $LDAPSEARCH = catFile($OUD,$BIN,${AS.BATCH:'ldapsearch'}) var %MNU loop $itm (@{W_MENU}) var $MNU{$itm} = true var $PRE = setPrefix() var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var $ADM = ["%s\012",'pseudo','host','OUD_ADMIN','Enter admin password:',''] var $BND = ["%s\012",'pseudo','host','OUD_DIRECTORY_MANAGER',\ 'Enter directory manager password:',''] pretoc '1:Oracle Unified Directory' echo 'This can take time. Be patient...' # Load the common library run RDA:library() # Macro to get the output of ldapsearch command macro exec_ldapsearch {var ($tbl,$cmd,$pre,$flg,$sta) = @arg import $TOP,$BND keep $TOP,$BND report $tbl->[1] prefix {write '---+ ',$tbl->[2] write '---## Using: ',encode(sprintf($cmd,'?')) if $pre write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } if $flg {call loadCommand({cmd => [$cmd,'2>&1'],pwf => $BND,sap => true}) if and($sta,status()) {unprefix return } call writeLastFile() } else call writeCommand({cmd => [$cmd,'2>&1'],pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc $tbl->[0],':[[',getFile(),'][rda_report][',$tbl->[-1],']]' } } # Set the instance symbol call setSymbol('$OI',$INSTANCE) =head2 abbr - Abbreviations Displays the RDA abbreviations defined for the Oracle Unified Directory collection. =cut debug ' Inside OUD module, collecting defined abbreviations' report abbr prefix {write '---+ Oracle Unified Directory Abbreviations' write '|*Abbreviation*|*Location*|' } var %hsh = getSymbols() loop $key (keys(%hsh)) write '|',$key,' |',$hsh{$key},' |' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Abbreviations]]' =head2 param_info - Parameter Information Gathers the user defined parameters. =cut debug ' Inside OUD module, getting parameter details' report param_info write '---+ Parameter Information' write '|*Oracle Home*|',encode($ORACLE_HOME),' |' write '|*Oracle Instance*|',encode($INSTANCE),' |' if $REPLICATION write '|*Admin User*|',$ADMIN_USER,' |' write '|*Admin Port*|',$ADMIN_PORT,' |' write '|*Directory Manager*|',$DIR_MANAGER,' |' write '|*LDAP Port*|',$LDAP_PORT,' |' write '|*LDAPS Port*|',$LDAPS_PORT,' |' write '|*Hostname*|',$HOST,' |' write '|*JDK Path*|',encode($JDK_HOME),' |' if isCreated() toc '2:[[',getFile(),'][rda_report][Parameter Information]]' =head2 version - Version Information Gathers version information. =cut if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'dsconfig'})) {debug ' Inside OUD module, getting version information' var $cmd = concat(lastTestCommand(),' -V') report version prefix {write '---+ Version Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][Version Information]]' } =head2 status - Status Information Gathers status information. =cut if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'status'})) {debug ' Inside OUD module, gathering status information' var $cmd = concat(lastTestCommand(),' --bindDN ',$DIR_MANAGER,\ ' --bindPasswordFile %s') report status prefix {write '---+ Status Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Status Information]]' } } =head2 network_group - Network Groups Lists network groups information. =cut if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'dsconfig'})) {debug ' Inside OUD module, gathering network groups information' var $cmd = concat($pgm = lastTestCommand(),' -h ',$HOST,' -p ',$ADMIN_PORT,\ ' -D ',$DIR_MANAGER,' --bindPasswordFile %s -X list-network-groups') report network_group prefix {write '---+ Network Group Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call loadCommand({cmd => $cmd,pwf => $BND,sap => true}) var @ngp = () loop $lin (getLines()) {next match($lin,'^(Network\s+Group|-+|\s*$)') call push(@ngp,field('\s*:\s*',0,$lin)) } call writeLastFile() if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Network Groups]]' } =head3 Network Group Gathers network group property information for each C. =cut debug ' Inside OUD module, gathering network group property information' loop $ngp (@ngp) {var $ngp = quote($ngp) var $cmd = concat($pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X get-network-group-prop --group-name ',$ngp) report concat('network_group_prop_',$ngp) prefix {write "---+ '",$ngp,"' Network Group Property Information" write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc '3:[[',getFile(),"][rda_report]['",$ngp,"' Network Group]]" } } =head2 workflows - Workflows Gathers workflows information. =cut debug ' Inside OUD module, gathering workflows information' var $cmd = concat($pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X list-workflows') report workflows prefix {write '---+ Workflows Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call loadCommand({cmd => $cmd,pwf => $BND,sap => true}) var @wrk = () loop $lin (getLines()) {next match($lin,'^(Workflow|-+|\s*$)') call push(@wrk,field('\s*:\s*',0,$lin)) } call writeLastFile() if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Workflows]]' } =head3 Workflow Property Information Gathers workflow property information for each C. =cut debug ' Inside OUD module, gathering workflow property information' loop $wrk (@wrk) {pretoc "3:'",$wrk,"' Workflow" var $wrk = quote($wrk) var $cmd = concat($pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X get-workflow-prop --workflow-name ',$wrk) report concat('workflow_prop_',$wrk) prefix {write "---+ '",$wrk,"' Workflow Property Information" write '---## Using: ',encode(sprintf($cmd,'?')) } call loadCommand({cmd => $cmd,pwf => $BND,sap => true}) var $bdn = '' if grepLastFile('^base-dn\s*:\s*([\042\047])(.*?)\1\s*$','f2') var $bdn = first call writeLastFile() if isCreated(true) {write $TOP toc '4:[[',getFile(),'][rda_report][Workflow Property Information]]' } # Check for ldapsearch existence if testFile($MOD,$LDAPSEARCH) {var $ldp = quote($LDAPSEARCH) # Gather EUS top level configuration if compare('eq',$wrk,'OracleContext') {debug " Inside OUD module, gathering EUS top level config for ${VAR.wrk}" var $cmd = concat($ldp,' -p ',$LDAP_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -b "cn=OracleContext" objectclass=*') call exec_ldapsearch([4,concat('wrk_',$wrk,'_eus_top_lvl'),\ "'${VAR.wrk}' EUS Top Level Configuration",\ 'EUS Top Level Configuration'],$cmd,undef,true,true) } # Collect based on derived base-dn if length($bdn) {# Gather access control information debug " Inside OUD module, gathering access control info for ${VAR.wrk}" var $cmd = concat($ldp,' -p ',$LDAP_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -b ',quote($bdn),' aci=* aci') call exec_ldapsearch([4,concat('wrk_',$wrk,'_aci_',$bdn),\ "'${VAR.wrk}' Access Control Information",\ 'Access Control Information'],$cmd) # Gather DIP information debug " Inside OUD module, gathering DIP info for ${VAR.wrk}" var $cmd = concat($ldp,' -p ',$LDAP_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -b "cn=Directory Integration Platform,',\ quote2($bdn),'" objectclass=*') call exec_ldapsearch([4,concat('wrk_',$wrk,'_dip_',$bdn),\ "'${VAR.wrk}' Directory Integration Platform Information",\ 'Directory Integration Platform Information'],$cmd,undef,true,true) # Gather EUS configuration information if compare('eq',$wrk,'OracleContext0') {debug " Inside OUD module, gathering EUS info for ${VAR.wrk}" var $cmd = concat($ldp,' -p ',$LDAP_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -b "',quote2($bdn),'" objectclass=*') call exec_ldapsearch([4,concat('wrk_',$wrk,'_eus_',$bdn),\ "'${VAR.wrk}' EUS Configuration Information",\ 'EUS Configuration Information'],$cmd,undef,true,true) } } } unpretoc } =head2 workflow_elements - Workflow Elements Lists workflow elements information. =cut debug ' Inside OUD module, gathering workflow elements information' var $cmd = concat($pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X list-workflow-elements') report workflow_elements prefix {write '---+ Workflow Elements Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call loadCommand({cmd => $cmd,pwf => $BND,sap => true}) var @wfe = () loop $lin (getLines()) {next match($lin,'^(Workflow\s+Element|-+|\s*$)') call push(@wfe,field('\s*:\s*',0,$lin)) } call writeLastFile() if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Workflow Elements]]' } =head3 Workflow Element Lists workflow element property information for each C. =cut debug ' Inside OUD module, gathering workflow element property information' loop $wfe (@wfe) {var $wfe = quote($wfe) var $cmd = concat($pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X get-workflow-element-prop --element-name ',$wfe) report concat('workflow_elements_prop_',$wfe) prefix {write "---+ '",$wfe,"' Workflow Element Property Information" write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc '3:[[',getFile(),"][rda_report]['",$wfe,"' Workflow Element]]" } } } =head2 aci_info - Access Control Information Gathers access control information. =cut if ?testFile($MOD,$LDAPSEARCH) {var $pgm = quote($LDAPSEARCH) debug ' Inside OUD module, gathering access control handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s -b \ "cn=Access Control Handler,cn=config" objectclass=*') call exec_ldapsearch([2,'aci_info','Access Control Information'],$cmd) =head2 Connection Handlers Gathers connection handlers information. =cut debug ' Inside OUD module, gathering connection handler information' pretoc '2:Connection Handlers' =head3 ldap_conn_hdl - LDAP Connection Handler Gathers Lightweight Directory Access Protocol (non-SSL) connection handler information. =cut debug ' - gathering LDAP connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDAP Connection Handler,cn=Connection Handlers,cn=config" \ objectclass=*') call exec_ldapsearch(\ [3,'ldap_conn_hdl','LDAP (non-SSL) Connection Handler Information',\ 'LDAP Connection Handler'],$cmd) =head3 ldaps_conn_hdl - LDAPS Connection Handler Gathers Lightweight Directory Access Protocol (SSL) connection handler information. =cut debug ' - gathering LDAPS connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config" \ objectclass=*') call exec_ldapsearch(\ [3,'ldaps_conn_hdl','LDAP (SSL) Connection Handler Information',\ 'LDAPS Connection Handler'],$cmd) =head3 snmp_conn_hdl - SNMP Connection Handler Gathers Simple Network Management Protocol connection handler information. =cut debug ' - gathering SNMP connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=SNMP Connection Handler,cn=Connection Handlers,cn=config" \ objectclass=*') call exec_ldapsearch(\ [3,'snmp_conn_hdl','SNMP Connection Handler Information',\ 'SNMP Connection Handler'],$cmd) =head3 jmx_conn_hdl - JMX Connection Handler Gathers Java Management Extensions connection handler information. =cut debug ' - gathering JMX connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=JMX Connection Handler,cn=Connection Handlers,cn=config" \ objectclass=*') call exec_ldapsearch(\ [3,'jmx_conn_hdl','JMX Connection Handler Information',\ 'JMX Connection Handler'],$cmd) =head3 ldif_conn_hdl - LDIF Connection Handler Gathers Lightweight Directory Interchange Format connection handler information. =cut debug ' - gathering LDIF connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDIF Connection Handler,cn=Connection Handlers,cn=config" \ objectclass=*') call exec_ldapsearch(\ [3,'ldif_conn_hdl','LDIF Connection Handler Information',\ 'LDIF Connection Handler'],$cmd) unpretoc =head2 db_config - Database Configuration Gathers Oracle Unified Directory-related database configuration information. =cut debug ' Inside OUD module, gathering database configuration information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=userRoot,cn=Workflow elements,cn=config" objectclass=*') call exec_ldapsearch(\ [2,'db_config','Database Configuration Information',\ 'Database Configuration'],$cmd) } =head2 Replication Information Gathers Oracle Unified Directory-related replication information. =head3 replication_status - Replication Status Gathers replication status information using F command. =cut if $REPLICATION {debug ' Inside OUD module, gathering replication information' pretoc '2:Replication Information' if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'dsreplication'})) {debug ' - gathering replication status information' var $cmd = concat(lastTestCommand(),\ ' status -h ',$HOST,' -p ',$ADMIN_PORT,' --adminUID ',\ $ADMIN_USER,' --adminPasswordFile %s -X -n') report replication_status prefix {write '---+ Replication Status Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => [$cmd,'2>&1'],pwf => $ADM,sap => true}) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Replication Status]]' } } =head3 replication_domains - Replication Domains Gathers replication domains information using F command. =cut var @dom = () if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'dsconfig'})) {debug ' - gathering replication domains information' var $cmd = concat($pgm = lastTestCommand(),\ ' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',\ $DIR_MANAGER,' --bindPasswordFile %s -X list-replication-domains \ --provider-name "Multimaster Synchronization"') report replication_domains prefix {write '---+ Replication Domains Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call loadCommand({cmd => $cmd,pwf => $BND,sap => true}) loop $lin (getLines()) {next match($lin,'^(Replication Domain|-+|\s*$|cn=admin data|cn=schema)') call push(@dom,field('\s*:\s*',0,$lin)) } call writeLastFile() if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Replication Domains]]' } =head3 replication_srv_prop - Replication Server Properties Gathers replication server properties information using F command. =cut debug ' - gathering replication server properties information' var $cmd = concat($pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X get-replication-server-prop \ --provider-name "Multimaster Synchronization"') report replication_srv_prop prefix {write '---+ Replication Server Properties Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Replication Server Properties]]' } =head3 replication_dom_prop - Replication Domain Properties Gathers replication domain properties information using F command. =cut debug ' - gathering replication domain properties information' var $cmd = concat(\ $pgm,' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X get-replication-domain-prop \ --provider-name "Multimaster Synchronization" \ --domain-name "dc=example,dc=com"') report replication_dom_prop prefix {write '---+ Replication Domain Properties Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Replication Domain Properties]]' } } =head3 Monitoring Replications Gathers monitoring replications information for each replication domain. =cut if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'ldapsearch'})) {debug ' - gathering replication domains information' pretoc '3:Monitoring Replications' loop $dom (@dom) {var $dom = quote($dom) var $cmd = concat(lastTestCommand(),\ ' -X -Z -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s \ -b cn=replication,cn=monitor domain-name=',$dom) report concat('replication_dom_mon_',$dom) prefix {write "---+ '",$dom,"' Monitoring Replications" write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) {write $TOP toc '4:[[',getFile(),'][rda_report][',$dom,']]' } } unpretoc } unpretoc } =head2 Configuration Files Gathers Oracle Unified Directory-related configuration files. =cut debug ' Inside OUD module, gathering configuration files' pretoc '2:Configuration Files' call sort_files(3,0,\ catFile($OUD,'config','admin-backend.ldif'),\ catFile($OUD,'config','buildinfo'),\ catFile($OUD,'config','config.ldif'),\ catFile($OUD,'config','config.ldif.startok'),\ catFile($OUD,'config','java.properties'),\ catFile($OUD,'config','tasks.ldif'),\ catFile($OUD,'config','tools.properties'),\ grepDir(catDir($OUD,'config','archived-configs'),'^\.+$','drv'),\ grepDir(catDir($OUD,'config','concat-schema'),'^\.+$','drv'),\ grepDir(catDir($OUD,'config','schema'),'^\.+$','drv'),\ grepDir(catDir($OUD,'config','snmp'),'^\.+$','drv')) unpretoc =head2 Log Files Gathers Oracle Unified Directory-related log files. =head3 log_cfg_settings - Logging Configuration Settings Gathers Oracle Unified Directory-related logging configuration settings. =cut debug ' Inside OUD module, gathering logging configuration settings' pretoc '2:Log Files' var $cmd = concat(catFile($OUD,$BIN,${AS.BATCH:'dsconfig'}),\ ' -h ',$HOST,' -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,\ ' --bindPasswordFile %s -X list-log-publishers') report log_cfg_settings prefix {write '---+ Logging Configuration Settings Information' write '---## Using: ',encode(sprintf($cmd,'?')) } call writeCommand({cmd => $cmd,pwf => $BND,sap => true}) if isCreated(true) toc '3:[[',getFile(),'][rda_report][Logging Configuration Settings]]' debug ' Inside OUD module, gathering log files' var (@log,%log) = () loop $pth (grepFile(catFile($OUD,'config','config.ldif'),\ '^ds-cfg-log-file:\s+(.+)$','1')) {if !isAbsolute($pth) var $pth = catFile($OUD,$pth) var ($dir,$nam) = parsePath($pth,'.log') var $log{$dir,$nam} = $pth } loop $dir (keys(%log)) call push(@log,grepDir($dir,\ '^(access|admin|debug|errors|replication|server\.(out|output|pid))','np')) if !scalar(@log) call push(@log,grepDir(catDir($OUD,'logs'),\ '^(access|admin|debug|errors|replication|server\.(out|output|pid))','np')) call sort_files(3,$TAIL,\ catFile($OUD,'logs','native-windows.out'),\ catFile($OUD,'logs','server.out'),\ catFile($OUD,'logs','server.pid'),\ @log,\ grepDir(catDir($OUD,'dbUserRoot'),'^je\.info','np'),\ grepDir(catDir($OUD,'bin'),'^hs_err_pid.*\.log$','p')) unpretoc =head1 DATABASE INFORMATION Gathers Oracle Unified Directory-related database information in advanced mode. =cut if and($ADVANCED,exists($MNU{'DB_INFO'})) {debug ' Inside OUD module, gathering database information' pretoc '%SPLIT%' pretoc '1+:Database Information' if ?testFile($MOD,catFile($OUD,$BIN,${AS.BATCH:'dbtest'})) {var ($cmd,@bid) = (concat($pgm = lastTestCommand(),' list-root-containers')) =head2 root_containers - Root Containers Lists root containers information. =cut debug ' - gathering root containers list' report root_containers prefix {write '---+ Root Containers Information' write '---## Using: ',encode($cmd) } call loadCommand($cmd) loop $lin (getLines()) {next match($lin,'^(Backend\s+ID|-+|\s*$|Total:)') call push(@bid,field('\s+',0,$lin)) } call writeLastFile() if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Root Containers]]' } =head2 Entry Containers Lists entry containers information for each C. =cut debug ' - gathering entry containers information' pretoc '2:Entry Containers' loop $bid (@bid) {var $bid = quote($bid) var ($cmd,@bdn) = (concat($pgm,' list-entry-containers -n ',$bid)) report concat('entry_containers_',$bid) prefix {write "---+ '",$bid,"' Entry Container Information" write '---## Using: ',encode($cmd) } call loadCommand($cmd) loop $lin (getLines()) {next match($lin,'^(Base\s+DN|-+|\s*$|Total:)') call push(@bdn,field('\s+',0,$lin)) } call writeLastFile() if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][',$bid,']]' } =head3 Index Status Lists index status information for each C per C. =cut if @bdn {debug ' - gathering index status information for ',$bid pretoc '4:Index Status' loop $bdn (@bdn) {var $bdn = quote($bdn) var $cmd = concat($pgm,' list-index-status -b ',$bdn,' -n ',$bid) report concat('index_status_',$bid,'_',$bdn) prefix {write "---+ '",$bdn,"' Index Status Information (",$bid,')' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc '5:[[',getFile(),'][rda_report][',$bdn,']]' } } unpretoc } } unpretoc =head2 Database Containers Lists database containers information for each C. =cut debug ' - gathering database containers information' pretoc '2:Database Containers' loop $bid (@bid) {var $bid = quote($bid) var $cmd = concat($pgm,' list-database-containers -n ',$bid) report concat('database_containers_',$bid) prefix {write "---+ '",$bid,"' Database Container Information" write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][',$bid,']]' } } unpretoc } unpretoc 2 } =head1 MONITOR INFORMATION Gathers monitor information. =cut if ?testFile($MOD,$LDAPSEARCH) {pretoc '%SPLIT%' pretoc '1+:Monitor Information' var $pgm = quote($LDAPSEARCH) var ($cur,$det,$max,$pre) = (0,2,1) if exists($MNU{'MONITOR_STAT'}) var ($det,$max,$pre) = (3,$LOOP,true) else debug ' Inside OUD module, gathering monitoring information' while expr('<',$cur,$max) {if and($cur,$SLEEP) {debug ' Inside OUD module, sleeping ',$SLEEP,' seconds' sleep $SLEEP } incr $cur if $pre {debug ' Inside OUD module, gathering monitoring (sample ',$cur,')' call setPrefix(concat($PRE,'cnt',$cur)) pretoc '2:Iteration ',$cur } =head2 cn_monitor - Monitor Status Gathers monitor status information. =cut debug ' - gathering monitor status' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=monitor" objectclass=*') call exec_ldapsearch([$det,'cn_monitor','Monitor Status'],$cmd,$pre) =head2 cn_version - Version Information Gathers monitor version information. =cut debug ' - gathering version information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=version,cn=monitor" objectclass=*') call exec_ldapsearch([$det,'cn_version','Version Information'],$cmd,$pre) =head2 cn_system - System Information Gathers monitor system information. =cut debug ' - gathering system information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=System Information,cn=monitor" objectclass=*') call exec_ldapsearch([$det,'cn_system','System Information'],$cmd,$pre) =head2 cn_ldap_con_hdl - LDAP Connection Handler Gathers monitor Lightweight Directory Access Protocol (non-SSL) connection handler information. =cut debug ' - gathering LDAP connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDAP Connection Handler 0.0.0.0 port ',$LDAP_PORT,\ ',cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_ldap_con_hdl','LDAP (non-SSL) Connection Handler Information',\ 'LDAP Connection Handler'],$cmd,$pre) =head2 cn_ldap_con_hdl_stat - LDAP Connection Handler Statistics Gathers monitor Lightweight Directory Access Protocol (non-SSL) connection handler statistics information. =cut debug ' - gathering LDAP connection handler statistics information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDAP Connection Handler 0.0.0.0 port ',$LDAP_PORT,\ ' Statistics,cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_ldap_con_hdl_stat',\ 'LDAP (non-SSL) Connection Handler Statistics Information',\ 'LDAP Connection Handler Statistics'],$cmd,$pre) =head2 cn_ldaps_con_hdl - LDAPS Connection Handler Gathers monitor Lightweight Directory Access Protocol (SSL) connection handler information. =cut debug ' - gathering LDAPS connection handler information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDAP Connection Handler 0.0.0.0 port ',$LDAPS_PORT,\ ',cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_ldaps_con_hdl','LDAP (SSL) Connection Handler Information',\ 'LDAPS Connection Handler'],$cmd,$pre) =head2 cn_ldaps_con_hdl_stat - LDAPS Connection Handler Statistics Gathers monitor Lightweight Directory Access Protocol (SSL) connection handler statistics information. =cut debug ' - gathering LDAPS connection handler statistics information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=LDAP Connection Handler 0.0.0.0 port ',$LDAPS_PORT,\ ' Statistics,cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_ldaps_con_hdl_stat',\ 'LDAP (SSL) Connection Handler Statistics Information',\ 'LDAPS Connection Handler Statistics'],$cmd,$pre) =head2 cn_jvm_mem_usage - JVM Memory Usage Gathers monitor Java virtual machine memory usage information. =cut debug ' - gathering JVM memory usage information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=JVM Memory Usage,cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_jvm_mem_usage','JVM Memory Usage Information',\ 'JVM Memory Usage'],\ $cmd,$pre) =head2 cn_jvm_stack_trace - JVM Stack Trace Gathers monitor Java virtual machine stack trace information. =cut debug ' - gathering JVM stack trace information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=JVM Stack Trace,cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_jvm_stack_trace','JVM Stack Trace Information',\ 'JVM Stack Trace'],\ $cmd,$pre) =head2 cn_dsk_space - Disk Space Monitor Gathers monitor disk space information. =cut debug ' - gathering disk space monitor information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=userRoot backend,cn=Disk Space Monitor,cn=monitor" \ objectclass=*') call exec_ldapsearch(\ [$det,'cn_dsk_space','Disk Space Monitor Information',\ 'Disk Space Monitor'],\ $cmd,$pre,true) =head2 cn_db_size - Database Size Gathers monitor database size information. This check is applicable for UNIX only. =cut if isUnix() {debug ' - gathering database size information' if grepLastFile('^disk-dir','f') {var $dir = field('\s*:\s*',1,last) var $cmd = concat('du -h ',quote($dir)) report cn_db_size prefix {write '---+ Database Size Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if isCreated(true) toc $det,':[[',getFile(),'][rda_report][Database Size]]' } } =head2 cn_db_env - Database Environment Gathers monitor database environment information. =cut debug ' - gathering database environment information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=userRoot Database Environment,cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_db_env','Database Environment Information',\ 'Database Environment'],\ $cmd,$pre) =for stopwords Backend backend =head2 cn_uesrroot_backend - User Root Backend Information Gathers monitor user root backend information. =cut debug ' - gathering user root backend information' var $cmd = concat($pgm,\ ' -X -Z -p ',$ADMIN_PORT,' -D ',$DIR_MANAGER,' --bindPasswordFile %s \ -b "cn=userRoot Backend,cn=monitor" objectclass=*') call exec_ldapsearch(\ [$det,'cn_uesrroot_backend','User Root Backend Information'],$cmd,$pre) if $pre {unpretoc call setPrefix($PRE) } } unpretoc 2 } =head1 JAVA TOOLS INFORMATION Gathers Oracle Unified Directory-related information using Java tools. =head2 jinfo - Java Information Gathers F command output (UNIX only). =cut pretoc '%SPLIT%' pretoc '1+:Java Tools Information' var ($pid) = grepFile(catFile($OUD,'logs','server.pid'),'^(\d+)$','f1') var ($cur,$det,$max,$pre) = (0,2,1) if exists($MNU{'JAVA_STAT'}) var ($det,$max,$pre) = (3,$LOOP,true) else debug ' Inside OUD module, gathering Java tools information' while expr('<',$cur,$max) {if and($cur,$SLEEP) {debug ' Inside OUD module, sleeping ',$SLEEP,' seconds' sleep $SLEEP } incr $cur if $pre {debug ' Inside OUD module, gathering Java tools info (sample ',$cur,')' call setPrefix(concat($PRE,'cnt',$cur)) pretoc '2:Iteration ',$cur } if and(isUnix(),testFile($MOD,catFile($JDK_HOME,'bin',${AS.EXE:'jinfo'}))) {debug ' - gathering Java information' var $cmd = concat(lastTestCommand(),' ',$pid) report jinfo prefix {write '---+ Java Information' write '---## Using: ',encode($cmd) if $pre write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][Java Information]]' } } =head2 jmap_heap - Heap Space Information Gathers heap space information using F command (UNIX only). =cut if and(isUnix(),testFile($MOD,catFile($JDK_HOME,'bin',${AS.EXE:'jmap'}))) {var $pgm = lastTestCommand() debug ' - gathering heap space information' var $cmd = concat($pgm,' -heap ',$pid) report jmap_heap prefix {write '---+ Heap Space Information' write '---## Using: ',encode($cmd) if $pre write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][Heap Space Information]]' } =for stopwords Histo histo =head2 jmap_histo - Histo Information Gathers histo information using F command (UNIX only). =cut debug ' - gathering histo information' var $cmd = concat($pgm,' -histo:live ',$pid) report jmap_histo prefix {write '---+ Histo Information' write '---## Using: ',encode($cmd) if $pre write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][Histo Information]]' } } =head2 jstat - Java Statistics Information Gathers F command output (UNIX only). =cut if and(isUnix(),testFile($MOD,catFile($JDK_HOME,'bin',${AS.EXE:'jstat'}))) {debug ' - gathering Java statistics information' var $cmd = concat(lastTestCommand(),' -gc ',$pid,' 1000 10') report jstat prefix {write '---+ Java Statistics Information' write '---## Using: ',encode($cmd) if $pre write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc $det,':[[',getFile(),'][rda_report][Java Statistics Information]]' } } if $pre {unpretoc call setPrefix($PRE) } } unpretoc 2 =head1 HANG CAPTURE Gathers instance hang-related information in advanced mode. =cut if and($ADVANCED,exists($MNU{'INSTANCE_HANG'})) {pretoc '%SPLIT%' pretoc '1+:Hang Capture' # Determine the command path if ${OS.linux} var $TOP_CMD = '/usr/bin/top' if ${OS.solaris} {var $PRSTAT = findCommand('prstat') var $PSTACK = findCommand('pstack') } if and(isUnix(),testFile($MOD,catFile($JDK_HOME,'bin',${AS.EXE:'jstack'}))) var $JSTACK = lastTestCommand() var $cur = 0 while expr('<',$cur,$LOOP) {if and($cur,$SLEEP) {debug ' Inside OUD module, sleeping ',$SLEEP,' seconds' sleep $SLEEP } incr $cur call setPrefix(concat($PRE,'cnt',$cur)) pretoc '2:Iteration ',$cur debug ' Inside OUD module, collecting hang capture (sample ',$cur,')' =head2 top - top Output Gathers C command output (applies to Linux only). =cut if ?$TOP_CMD {debug ' - gathering top output' var $cmd = concat($TOP_CMD,' -H -p ',$pid,' -n 1') report top prefix {write '---+ top Output' write '---## Using: ',encode($cmd) write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand({cmd => $cmd, env => {TERM => 'dumb'}}) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][top Output]]' } } =for stopwords pstack =head2 pstack - pstack Output Gathers C command output (applies to Solaris only). =cut if ?$PSTACK {debug ' - gathering pstack output' var $cmd = concat($PSTACK,' ',$pid) report pstack prefix {write '---+ pstack Output' write '---## Using: ',encode($cmd) write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][pstack Output]]' } } =for stopwords prstat =head2 prstat - prstat Output Gathers C command output (applies to Solaris only). =cut if ?$PRSTAT {debug ' - gathering prstat output' var $cmd = concat($PRSTAT,' -L -p ',$pid) report prstat prefix {write '---+ prstat Output' write '---## Using: ',encode($cmd) write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][prstat Output]]' } } =for stopwords jstack =head2 jstack - jstack Output Gathers C command output (UNIX only). =cut if ?$JSTACK {debug ' - gathering jstack output' var $cmd = concat($JSTACK,' -l ',$pid) report jstack prefix {write '---+ jstack Output' write '---## Using: ',encode($cmd) write '---### Executed at: ',${RDA.T_GMTIME},' UTC' } call writeCommand($cmd) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][jstack Output]]' } } unpretoc call setPrefix($PRE) } unpretoc 2 } unpretoc =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.29: Olivier Rivat. =item RDA 8.00: Steve Jackle, Olivier Rivat. =item RDA 8.02: Olivier Rivat. =item RDA 8.03: Laurence Caullet. =item RDA 8.04: Olivier Rivat. =item RDA 8.05: Olivier Rivat. =item RDA 8.06: Olivier Rivat. =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