# S241MAIL.def: Collects Oracle Collaboration Suite Mail Information # $Id: S241MAIL.def,v 1.17 2009/02/06 18:22:54 mschenke Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/S241MAIL.def,v 1.17 2009/02/06 18:22:54 mschenke Exp $ # # Change History # 20090206 DEM Encode file names. =head1 NAME S241MAIL - Collects Oracle Collaboration Suite Mail Information =head1 DESCRIPTION The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing Mail Server module ...',tput('off') # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $AGE = getSetting('OCS_AGE', 15) var $TAIL = getSetting('OCS_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 library() run OCS() # 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 getSetting('EMAIL_ALL') var @prc = keys(%dsc) else var @prc = split(',',getSetting('EMAIL_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 } =head2 LDAP Information Performs some LDAP queries to get process information, process connection information, and the original users. Requests the C password. For batch/cron 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 the orcladmin password if getSetting('SQL_PASSWORD_LDAP_ORCLADMIN') var ($pwd) = unpack('u',last) elsif getSetting('OCS_LDAP') var $pwd = last else {var $pwd = askPassword(concat('Enter orcladmin password: ')) call setTempSetting('OCS_LDAP',nvl($pwd,'?')) } # Get other required information to perform LDAP queries var $dom = getSetting('LDAP_DOMAIN') var $hst = getSetting('LDAP_HOST') var $prt = getSetting('LDAP_PORT') # 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,$pwd) = @arg if $flg {var $out = getTemp('ldapsearch','.txt') var $cmd = concat($cmd,' >',quote($out,'x'),' 2>&1') output P,$cmd write $pwd close report $rpt prefix write '---+ ',$ttl call writeFile($out) call unlinkTemp('ldapsearch') } else {report $rpt prefix write '---+ ',$ttl call writeCommand(concat($cmd,' 2>&1')) } 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',concat('-w ',$pwd)),\ ' -L -s sub -b "cn=computers,cn=oraclecontext" -v "cn=*"') call exec_ldapsearch($cmd,'proc_info','Process Information','Processes',\ $flg,$pwd) var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q',concat('-w ',$pwd)),\ ' -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,$pwd) loop $prc (@prc) {next missing($dsc{$prc}) var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q',concat('-w ',$pwd)),\ ' -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,$pwd) var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q',concat('-w ',$pwd)),\ ' -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,$pwd) } var $cmd = concat($pgm,' -h ',$hst,' -p ',$prt,' -D "cn=orcladmin" ',\ cond($flg,'-q',concat('-w ',$pwd)),\ ' -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,$pwd) 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 (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 var $fil = getSetting('EMAIL_LISTENER') if !testFile('f',$fil) 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-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