Set OBIEE Email Server settings via WLST (11g/12c)

Alternative Title: Relearning WLST

I am currently in the process of redoing all of my OBIEE install/configure scripts as I am moving from 11g to 12c. Turns out, a lot of my old WLST scripts will need to be heavily modified. Some simple things like going from oracle.biee.admin to oracle.bi.admin – And some major changes with things like locking/saving.

After messing around with different bits, and reading different Oracle docs, I finally got a hint when I noticed editCustom() on this Oracle doc.

The Settings

These are the settings we are looking to modify in this example: - SMTP server - Port - Display name of sender - Email address of sender

How it would look in the EM (BI Instance->Configuration->Mail)

obiee-email-em-1

How it would look in the MBean Browser

obiee-email-mbean-1

The Code

11g

connect('weblogic', 'Password123', 't3://localhost:7001')

# Be sure we are in the root
cd('..\..')

print 'Connecting to Domain ...'
try:
        domainCustom()
except:
        print 'Already in domainCustom'

print 'Go to biee admin domain'
cd('oracle.biee.admin')

# Lock system
cd ('oracle.biee.admin:type=BIDomain,group=Service')
objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
try:
        invoke('lock', objs, strs)
except:
        print 'System already locked'

# Go to the Deployment/Mail Configuration
cd('..')
cd('oracle.biee.admin:type=BIDomain.BIInstance.EmailConfiguration,biInstance=coreapplication,group=Service')

# SMTP Server
newSmtpServer = "smtp.example.com"
set('SmtpServer',newSmtpServer)

# SMTP Server Port
newSmtpServerPort = 25
set('SmtpServerPort',newSmtpServerPort)

# Display name of SenderSenderDisplayName
newSenderDisplayName = "OBIEE Reports"
set('SenderDisplayName',newSenderDisplayName)

# Email Address of Sender
newSenderEmailAddress = "noreply@example.com"
set('SenderEmailAddress',newSenderEmailAddress)

# Commit changes
cd ('..')
cd ('oracle.biee.admin:type=BIDomain,group=Service')
objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
try:
        invoke('commit', objs, strs)
except:
        print('System not locked')


disconnect()
exit()

12c

connect('weblogic', 'Password123', 't3://localhost:9500')

#Start Edit
editCustom()
startEdit()

# Nav to email config
cd('oracle.bi.admin')
cd('oracle.bi.admin:Type=EmailConfig,Name=BISchedulerEmailConfiguration')

# SMTP Server
newSmtpServer = "smtp.example.com"
set('SmtpServer',newSmtpServer)

# SMTP Server Port
newSmtpServerPort = 25
set('SmtpServerPort',newSmtpServerPort)

# Display name of SenderSenderDisplayName
newSenderDisplayName = "OBIEE Reports"
set('SenderDisplayName',newSenderDisplayName)

# Email Address of Sender
newSenderEmailAddress = "noreply@example.com"
set('SenderEmailAddress',newSenderEmailAddress)

#End Edit
save()
activate()

Running WLST scripts

As always, this is how you would execute the script

source $ORACLE_HOME/wlserver/server/bin/setWLSEnv.sh
java weblogic.WLST theEmailScript.py
Avatar
Andrew Martin
Manager of Support
comments powered by Disqus