Enabling email alerts

OpsCenter can post alerts to multiple email addresses. To send alerts to multiple email addresses, create a different email configuration file with settings for each email address.

To enable email alerts, edit the <config_location>/event-plugins/email.conf file and provide valid SMTP server host and port information.

Prerequisites

Make sure that you have valid SMTP mail accounts to send and receive alerts.

Procedure

  1. On the OpsCenter daemon host, open the email.conf file for editing.
  2. Set enabled to 1.
  3. Provide valid values for your SMTP host, port, user, and password.
  4. (Recommended) For secure communications, enable Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocol on your system. Typically, SSL is required.
  5. Provide valid values for the to_addr and from_addr email addresses. The to_addr value is the account that will receive alerts.
  6. Optional: Set the specific levels of alerts to send. The default is to listen for all levels.
  7. Optional: Customize the subject line as desired. Available options are described in the config file comments.
  8. Save <config_location>/event-plugins/email.conf and restart the OpsCenter daemon.
    To send alerts to multiple email addresses, create a different email configuration file with settings for each email address. All configuration files are loaded so name them as email1.conf, email2.conf, and so on.

Example

For a configuration with email alerts enabled for a warning level and SSL enabled, the <config_location>/event-plugins/email.conf looks like:

[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
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=cassandra_admin@acme.com
from_addr=mercury@gmail.com

# Customizable subject for email.  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}

Example

The email subject could appear as:

[WARN] OpsCenter Event - Node reported as being down: 127.0.0.1