The Multi-Channel Alerts feature in CloudBolt allows CB Admins to decide how to send notifications about different kinds of alerts from the product. Currently, it supports sending alerts to Slack and Email. This can be useful for making sure that the right people are aware of events occurring in CloudBolt, such as posting administrative changes to a certain Slack channel or emailing members of the IT department about security events.
Configuring Alert Channels¶
The mechanism for configuring Multi-Channel Alerts is to first create an Alert Channel, then associate this channel with one or more alert categories. When an alert is sent to a particular category, it will determine which Alert Channels are associated with that category and route notifications appropriately. For example, if the out-of-the-box “cloudbolt.security” category is associated with both an Email Alert Channel and a Slack Alert Channel, any alert with that category will wind up as a Slack message in the Slack channel(s) defined on the Slack Alert Channel and as an Email in the inbox of any recipients defined on the Email Alert Channel.
To add, edit, or delete Alert Channels, navigate to their list page from. The table therein displays the most important details of the configured Alert Channels, with a few more type-specific details visible in the Edit form. When adding an Alert Channel, you will be presented with a choice of types and, once you select one, will be directed to the appropriate form to provide the necessary information for that type.
Please note that alert categories are simply entered in these forms as a comma-separated list. There is not currently any mechanism to ensure that the categories associated with a channel match relevant categories that alerts are actually sent to.
Some alerts are sent automatically by the product as a result of different events that occur, such as a user logging in. Currently, there are two out-of-the-box categories of alerts: “cloudbolt.security” and “cloudbolt.admin”. If no Alert Channels are configured for one or both of these categories, no notification will actually be sent by these alerts.
Alerts that are automatically sent for the “cloudbolt.security” category include user login, permission changes, requests for console access to a VM, user creation or deletion, and password resets or changes.
The “cloudbolt.admin” category is for events that might change system functionality. The alerts that are generated include creation, deletion, and changes that merit history events for Resource Handler, Environment, and Blueprint objects. They also include creating, deleting, or renaming a Group.
Sending Custom Alerts¶
In addition to the product’s out-of-the-box alerts, when writing custom code for CloudBolt, such as an action or Recurring Job, you can also send your own custom alerts. For these alerts you can designate your own categories, which you can then associate with Alert Channels to determine where your alerts get sent. Please note there is no mechanism to ensure that the category you send an alert to matches any configured Alert Channels.
To send an alert, use the
alert() method from
pass it a category and a message describing the event, which will be sent in the
For example, to send an alert about having called an action named “Customize VM”, you might add this code to your CloudBolt plug-in:
from alerts.methods import alert def run(...) alert("actions", "The 'Customize VM' action has performed its customization")
Then, you would just need to configure one or more Alert Channels to be associated with the “actions” category, and you could start sending Slack messages and/or Emails!