# DCmail.ctl:241:Collects Oracle Collaboration Suite Mail Information # $Id: DCmail.ctl,v 1.8 2015/05/28 18:52:06 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCmail.ctl,v 1.8 2015/05/28 18:52:06 RDA Exp $ # # Change History # 20150527 KRA Improve the documentation. =head1 NAME OFM:DCmail - Collects Oracle Collaboration Suite Mail Information =head1 DESCRIPTION The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing OFM.MAIL module ...',tput('off') # Initialization var $AGE = ${GRP.OCS.R_AGE/T:15} var $ORACLE_HOME = ${D_ORACLE_HOME/P:''} var $TAIL = ${GRP.OCS.N_TAIL1:5000} var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '^1:Oracle Collaboration Suite' pretoc '1+:Mail Server' # Load the common macros run OFM:OCS() run RDA:library() # Get selected processes var %dsc = ('admin', 'Admin',\ 'emd', 'EMD',\ 'gc', 'GC',\ 'imap', 'IMAP4',\ 'list', 'LIST',\ 'nntp_in', 'NNTP In',\ 'nntp_out', 'NNTP Out',\ 'oesadmin', 'OESadmin',\ 'oesucr', 'OESucr',\ 'pop', 'POP3',\ 'smtp_in', 'SMTP In',\ 'smtp_out', 'SMTP Out',\ 'vs', 'VS') if ${B_ALL} var @prc = keys(%dsc) else var @prc = @{W_PROCESSES} =head2 Configuration Files For UNIX, it collects the following mail files: =over 2 =item o F =item o F =back =cut if isUnix() {pretoc '2:Configuration Files' debug ' Inside MAIL module, about to gather configuration files' call cat_report('/etc/mail','sendmail.cf') call cat_report('/etc/mail','aliases') unpretoc } =for stopwords cron =head2 LDAP Information Performs some LDAP queries to get process information, process connection information, and the original users. Requests the C password. For C/C execution, you can encode the password in the setup file using the pseudo user C. =cut if grepCommand(concat(catCommand($ORACLE_HOME,'bin','ldapsearch'),' -H 2>&1'),\ '\s-q\s','f') var ($flg,$pgm) = (true,lastCommand()) elsif ?findCommand('ldapsearch') var ($flg,$pgm) = (false,last) else var $pgm = undef if $pgm {# Get other required information to perform LDAP queries var ($dom) = match(${GRP.OCS.T_LDAP_DOMAIN},'^([\040-\041\043-\377]*)$') var $hst = isHost(${GRP.OCS.T_LDAP_HOST},true) var $prt = isPort(${GRP.OCS.N_LDAP_PORT},true) # Perform the LDAP queries if and($hst,$prt) {# Macro to get the output of ldapsearch command macro exec_ldapsearch {var ($cmd,$rpt,$ttl,$lnk,$flg) = @arg if $flg {var $out = getTemp('ldapsearch','.txt') var $cmd = concat($cmd,' >',$out,' 2>&1') output | $cmd call derivePassword('pseudo','host','orcladmin','LDAP_ORCLADMIN') call writePassword("%s\012",\ 'pseudo','host','orcladmin',"Enter 'orcladmin' user password:",'') close report $rpt prefix write '---+ ',$ttl call writeFile($out) call unlinkTemp('ldapsearch') } else {report $rpt prefix write '---+ ',$ttl call writeCommand({\ cmd => concat($cmd,' 2>&1'),\ pwd => ['pseudo','host','LDAP_ORCLADMIN',\ "Enter 'orcladmin' user password:",'']}) } if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$lnk,']]' } pretoc '2:LDAP Information' var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q','-w %s'),\ ' -L -s sub -b "cn=computers,cn=oraclecontext" -v "cn=*"') call exec_ldapsearch($cmd,'proc_info','Process Information','Processes',$flg) var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q','-w %s'),\ ' -L -s sub -b "cn=mailstores,cn=um_system,\ cn=emailservercontainer,cn=products,cn=oraclecontext" \ -v "cn=*"') call exec_ldapsearch($cmd,'proc_cnx_info','Process Connection Information',\ 'Processes Connection',$flg) loop $prc (@prc) {next missing($dsc{$prc}) var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q','-w %s'),\ ' -L -s sub -b "cn=computers,cn=oraclecontext" \ -v "cn=*',$prc,'*"') call exec_ldapsearch($cmd,concat('ldap_',$prc,'_proc'),\ 'Process Information',concat($dsc{$prc},' Process'),\ $flg) var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q','-w %s'),\ ' -L -s sub -b "cn=mailstores,cn=um_system,\ cn=emailservercontainer,cn=products,cn=oraclecontext" \ -v "cn=*',$prc,'*"') call exec_ldapsearch($cmd,concat('ldap_',$prc,'_proc_cnx'),\ 'Process Connection Information',\ concat($dsc{$prc},' Process Connection'),$flg) } var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q','-w %s'),\ ' -s sub -b "cn=users,',$dom,'" -v "(|(cn=orcl*)(cn=uddi*)\ (cn=portal*)(cn=public)(cn=ias_admin)(cn=discussion*)\ (cn=cw_ecm*))"') call exec_ldapsearch($cmd,\ 'original_users','Original Users','Original Users',$flg) unpretoc } } =head2 Log Files For the selected processes, it lists the most recent log directories and collects the last lines of the most recent log files (mail server version 10.1.2). =cut var $top = catDir($ORACLE_HOME,'oes','log','um_system') if ?testDir('dr',$top) {pretoc '2:Log Files' # Treat the processes loop $prc (@prc) {next missing($dsc{$prc}) var $dir = catDir($top,$prc) debug ' Inside MAIL module, about to gather ',$prc,' log files' report concat('log_',$prc) # List directories and get the last log write '---+!! ',encode($dsc{$prc}) write $TOC call get_last_log($dir,$AGE,$TAIL) # Add it in the table of content toc '3:[[',getFile(),'][rda_report][',$dsc{$prc},']]' } unpretoc } =head2 listener_es_log - Listener_es Log Extracts the last lines of the F file. =cut if !?testFile('f',$fil = ${F_LISTENER}) var $fil = catFile($ORACLE_HOME,'network','log','listener_es.log') debug ' Inside MAIL module, process listener_es.log' report listener_es_log prefix {write '---+ Last ',$TAIL,' Lines of listener_es.log File' write '---## Information Taken from ',encode($fil) } call writeTail($fil,$TAIL) if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Listener_es Log]]' } =head2 not_found - Not found Used as a warning when none of the Oracle Collaboration Suite Mail files are found. =cut if !isTocCreated() {debug ' Inside MAIL module, no file found' report not_found write 'No Oracle Collaboration Suite Mail 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]]' } # Disable the group title in next index toc '-:Oracle Collaboration Suite' =head1 SEE ALSO L, L, L =begin credits =over 10 =item RDA 4.1: Stefano Montero. =item RDA 4.2: Frederic Daurelle. =item RDA 4.6: Frederic Daurelle, Takayuki Hamaguchi. =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