Sending email notifications

Virtuozzo Hybrid Infrastructure can send automatic email notifications about errors, warnings, and alerts.

Prerequisites

  • The management node must be able to access the SMTP server.

To set up email notifications

Admin panel

  1. Go to Settings > System settings > Email notifications and turn on the toggle switch Enable email notification.
  2. Specify the SMTP server details:

    • In User account and User password, the credentials of the notification sender registered on the SMTP server.
    • In SMTP server, the DNS name of the SMTP server, either public (for example, smtp.gmail.com) or the one in your organization.
    • In SMTP port, a custom SMTP port that the server uses.
    • In Security, the security protocol of the SMTP server.

  3. Select Errors, Warnings, and/or Information, to be notified about these alerts.
  4. Specify the sender and recipient details:

    • In From and Sender name, the notification sender’s email and name.
    • In To , enter one or more notification recipients’ emails, comma separated.

  5. To send a test email, click Test.
  6. Click Save to apply your changes.

Command-line interface

Use the following command:

vinfra cluster settings email-notifications set [--user-account <user-account>]
                                                [--user-password <user-password>]
                                                --smtp-server <smtp-server>
                                                --smtp-port <smtp-port>
                                                --security {SSL,STARTTLS}
                                                --severity {error,warning,info}
                                                [--from <from>] [--sender-name <sender-name>]
                                                [--email-recipients-list <email-recipients-list>]
--user-account <user-account>
User account of the notification sender
--user-password <user-password>
Password for the user account
--smtp-server <smtp-server>
DNS name of the SMTP server
--smtp-port <smtp-port>
SMTP port used by the SMTP server
--security {SSL,STARTTLS}
Security protocol of the SMTP server
--severity {error,warning,info}
Severity type of email notifications. This option can be used multiple times.
--from <from>
Email address of the notification sender
--sender-name <sender-name>
Notification sender name
--email-recipients-list <email-recipients-list>
A comma-separated list of notification recipients' emails

For example, to set up email notification from notifier@example.com to user1@example.com, user2@example.com, and user3@example.com, run:

# vinfra cluster settings email-notifications set --user-account notifier@example.com --user-password ****** \
--smtp-server smtp.example.com --smtp-port 587 --security SSL --severity warning --severity error \
--from notifier@example.com --sender-name "Event notifier" --email-recipients-list user1@example.com,user2@example.com,user3@example.com

You can view the email notifications settings in the vinfra cluster settings email-notifications show output:

# vinfra cluster settings email-notifications show
+-----------------------+------------------------------------+
| Field                 | Value                              |
+-----------------------+------------------------------------+
| notification_settings | alerts_severities:                 |
|                       | - warning                          |
|                       | - error                            |
|                       | email_recipients_list:             |
|                       | - user1@example.com                |
|                       | - user2@example.com                |
|                       | - user3@example.com                |
|                       | from: notifier@example.com         |
|                       | sender_name: Event notifier        |
| smtp_settings         | account_name: notifier@example.com |
|                       | connection_security: SSL           |
|                       | port: 587                          |
|                       | smtp_server: smtp.example.com      |
+-----------------------+------------------------------------+

To disable email notifications

Admin panel

  1. Go to Settings > System settings > Email notifications and turn off the toggle switch Enable email notification.
  2. Click Save to apply your changes.

Command-line interface

Use the following command:

vinfra cluster settings email-notifications disable