Enabling SMTP email alerts
Send alerts to multiple email addresses. Customize the email template for the subject and body of the message.
OpsCenter can send alerts to multiple email addresses. To enable email alerts, edit the config_location/event-plugins/email.conf file and provide valid SMTP server host and port information.
Multiple instances of the email.conf
file results in multiple
instances of an event plugin. The email configuration file can have any name
provided the file has the .conf file extension, contains the valid event plugin
identifier [email]
, and resides in the event-plugins directory
location. All configuration files are loaded, so differentiate the file names such
as email1.conf, email2.conf, and so on.
Multiple plugin instances facilitate flexibility when setting up alerts to different
email recipients for development and production clusters. All OpsCenter event
plugins support multiple configurations files and subsequent plugin instances.
Prerequisites
Procedure
Example
[email]
# set to 1 to enable email
enabled=1
# levels can be comma-delimited list of any of the following:
# DEBUG,INFO,WARN,ERROR,CRITICAL,ALERT
# If left empty, will listen for all levels
levels=WARN,ERROR
# clusters is a comma-delimited list of cluster names for which
# this alert config will be eligible to run.
# If left empty, this alert will be called for events on all clusters
clusters=
smtp_host=smtp.gmail.com
smtp_port=465
smtp_user=mercury@gmail.com
smtp_pass=*********
smtp_use_ssl=1
smtp_use_tls=0
smtp_retries=1
smtp_timeout=5
to_addr=dse_admin@acme.com,devOps@acme.com,opsc_admin@acme.com
from_addr=mercury@gmail.com
# Customizable templates for subject and body. The key specified in {}'s must map to the items provided in json map at the end of
# the emails. For example, some available keys are:
# node, cluster, datetime, level_str, message, target_node, event_source, success, api_source_ip, user, source_node
# more advanced formatting options explained here: https://docs.python.org/2/library/string.html#formatspec
subject=[{level_str}] OpsCenter Event on {cluster} - {message}
template=Message: {message}
Time: {datetime}
Level: {level_str}
Cluster: {cluster}
Node: {node}
User: {user}
Example
A custom email template example:
template=Hey support staff! Wanted to let you know that {cluster} says, {message} This is {level_str} level, and you may want to check out http://support.lan/opscenter_alerts_guide for further information.
An example email alert:
