Configuring Email Notifications
Events can be sent via email, the event payload is in XML format. See examples further down.
Enabling email notifications requires three steps to be completed:
-
Configure Email Server
-
Create a Local User within the cluster
-
Add Notification Rules
-
Configuring the Email Server. This step has to be done using the admin CLI. The configuration can be set and updated with the same command event-smtpgw-define. A single email server can be configured.
# event-smtpgw-define --from-address admin@mycompany.com --host my.mail.server --port 25 --ssl
Optionally a user and password can be configured if the email server requires credentials.
-
Create a Local User. Continue using the CLI with the user-create command or switch into the GUI and navigate to Administration->Users. Only viewer role is required for users created for the purpose of notifications.
A local user with a correct email address must be created for every email destination where notifications are sent. For example, emails can be sent to different addresses depending on the severity of the event.
# user-create --email info@admin.it --role-name viewer --username info_events
Name: info_email ID: aa3540cf-8758-41d1-af74-c9d4771bc883 UID: 1301 GID: 100 Email: info@admin.it Enabled: true Role: viewer # user-create --email alert@admin.it --role-name viewer --username alert_events
Name: alert_email ID: 87557a34-2504-471a-8a50-404a48643983 UID: 1302 GID: 100 Email: alert@admin.it Enabled: true Role: viewer -
Notification Rules. Create one or more notification event rules that determine what type of notification is sent to where. A notification event rule can be configured with multiple users but only a single threshold. To receive notifications on all thresholds, a event rule must be configured for each threshold.
The thresholds are: INFORMATIONAL | NOTICE | WARNING | ERROR | CRITICAL | ALERT | EMERGENCY .
Example: Sending INFORMATIONAL events to a single destination and send critical events to two destinations.
# notification-rule-create --name info_events --format XML --threshold informational --users info_events
# notification-rule-create --name alert_events --format XML --threshold alert --users info_events,alert_events