CLI cookbook: about alert notifications
The Delphix Engine can send out email notifications when alerts happen. Alert profiles control this functionality.
An alert profile is composed of two things:
Filter specification: A filter, or combination of filters, that specifies which alerts are of interest.
Alert action: This specifies the email addresses to which the Delphix Engine will send an email when an alert matches the filter specification.
By default, the Delphix Engine has a single alert profile configured with the following parameters:
Filter Specification: Match any alert with a severity level of CRITICAL or WARNING.
Alert Actions: Send an email to the address defined for user admin.
The default domain user created on Delphix Engines is now admin instead of delphix_admin. When engines created before 5.3.1 are upgraded to 5.3.1 or later they will retain their old username 'delphix_admin'. To avoid complications Delphix recommends creating users with an admin role and then Disabling delphix_admin.
Using the CLI, it is possible to:
Modify the system default alert profile
Create additional profiles in addition to the default one
Set multiple actions for a single profile, such as "email dephix_admin" and "email user1@mycompany.com"
Simple filters
Filtered by Owner of alerts target – for example, objects owned by user 1
Complex filters
Complex filters combine/modify other sub-filters:
“And” filter – Used when all conditions defined must be met for the filter to notify the user with an email
“Or” filter – Used when either one or the other of the conditions defined in the filters must be met for the filter to notify the user with an email
“Not” filter – Used to exclude items
Limitations
This is a CLI feature.
Alert Profiles do not override permission settings. If you do not have Read permission on an object then your alert profile will never get triggered for that object's alerts, regardless of your filter settings.
The following CLI examples will run through how to create these three filters. Each example provides three different methods of setting up a profile. These include the following:
A simple profile
A profile with two filters
A complicated profile
For more information, see CLI Cookbook: creating alert profiles
A simple profile
A simple profile approach matches the Delphix out-of-the-box default alert profiles. To create a simple alert profile using the CLI as seen in the figure below, go into the alert profile section of the command-line interface (CLI) and create a new profile. Line four prompts the engine to send an email when the filters are triggered. The following three command lines refer to the filter specifications. Follow two severity levels: warning and critical. This will trigger an email alert when any warning or critical events occur.
twalsh-trunk.dcenter> cd alert
twalsh-trunk.dcenter alert> cd profile
twalsh-trunk.dcenter alert profile> create
twalsh-trunk.dcenter alert profile create *> set actions.0.type=AlertActionEmailUser
twalsh-trunk.dcenter alert profile create *> set filterSpec.type=SeverityFilter
twalsh-trunk.dcenter alert profile create *> set filterSpec.severityLevels.0=CRITICAL
twalsh-trunk.dcenter alert profile create *> set filterSpec.severityLevels.1=WARNING
twalsh-trunk.dcenter alert profile create *> commit
A compound alert profile
Creating a compound alert profile in the CLI will combine two filters together. This profile triggers an email about any alert on objects owned by the delphix_admin plus any other alert that is critical. The compound alert profile creates two filters. The first one will be the target owner filter, which in this case is admin. The second filter is the severity filter, allowing users to match anything that is critical. Combine these two filters using the OR logic so that if any of the sub-filters match, the whole filter matches. An example of this can be seen in the figure below.
![](../../__attachments/205327227/image-20230706-065054.png?inst-v=9f5cd9ef-94fe-4677-b3c4-6c5d1617af5c)
Alert profile using OR logic
While working in the CLI, the first four lines describe a simple alert profile. The distinction between simple and compound alert profiles is that in a compound profile, the top-level filter uses an OR filter with sub-filters for target owner and severity level, as seen in line five of the figure below.
twalsh-trunk.dcenter> cd alert
twalsh-trunk.dcenter alert> cd profile
twalsh-trunk.dcenter alert profile> create
twalsh-trunk.dcenter alert profile create *> set actions.0.type=AlertActionEmailUser
twalsh-trunk.dcenter alert profile create *> set filterSpec.type=OrFilter
twalsh-trunk.dcenter alert profile create *> set filterSpec.subFilters.0.type=TargetOwnerFilter
twalsh-trunk.dcenter alert profile create *> set filterSpec.subFilters.0.owners.0=delphix_admin
twalsh-trunk.dcenter alert profile create *> set filterSpec.subFilters.1.type=SeverityFilter
twalsh-trunk.dcenter alert profile create *> set filterSpec.subFilters.1.severityLevels.0=CRITICAL
twalsh-trunk.dcenter alert profile create *> commit
Complex alert profile
A complex alert profile uses the profile filter created in the compound alert profile and modifies it. For the example shown in the figure below, you have a VDB named test_instance that you do not need any emails about. The following commands will create an effective filter.
Create an OR filter with two sub filters: target owner and event type.
Create a NOT filter which will exclude the VDB (test_instance) from which you do not want to receive notifications.
Use the AND logic to combine all these filters together, as seen below.
![](../../__attachments/205327227/image2018-4-27_16-8-31.png?inst-v=9f5cd9ef-94fe-4677-b3c4-6c5d1617af5c)
Complex alert profile
Below is an example of the command lines used to set up this complex profile.
![](../../__attachments/205327227/image2018-4-27_16-8-47.png?inst-v=9f5cd9ef-94fe-4677-b3c4-6c5d1617af5c)
Complex alert profile CLI