Dotcom-Monitor offers the flexibility to customize alert notifications according to specific monitoring device states, such as Alerting (downtime alerts) or OK (uptime alerts) states.
Configuring Delivery Addresses for Specific Alert Types
For the purpose of this article, we will use email delivery addresses. However, the described approach is applicable to other types of delivery addresses.
To receive customized alert notifications based on alert types, follow these steps:
- Create a Delivery Address Group.
- Add an Email Address for downtime alert notifications:
- Within the group, add a new email address designated for downtime alerts.
- Access the address’s advanced settings and select Alerting alert type.
- Customize the subject line and message body by creating new templates, as detailed in the Alert Templates Guide.
- Save the settings to apply your configurations.
- Add an Email Address for uptime alert notifications:
- To receive uptime alerts, add the same email address as in step 2 to the group. Dotcom-Monitor can send uptime alert notifications ONLY to the same delivery addresses or alert groups that were set to receive downtime alerts. For more information, refer to Uptime Alerts.
- Select the OK alert type in the address’s advanced settings.
- Customize the subject and message templates accordingly.
- Save the settings to finalize the configuration.
With this setup, the specified email address will receive notifications corresponding to the monitoring alert type (downtime or uptime).
Utilizing Conditional Alert Templates for Large Recipient Groups
For scenarios involving a large group of recipients we recommend using conditional logic within a single alert template.
In the templates provided below, the @switch
statement evaluates the Model.AlertType
to determine the type of the monitoring event (whether it’s an error or an uptime notification) and modifies the subject and message content accordingly.
Conditional Subject Template
@switch (Model.AlertType) { case Dotcom.Reporting.Common.NotificationType.Error: <text> ERROR alert for device "@Model.Site_Name" </text> break; case Dotcom.Reporting.Common.NotificationType.Uptime: <text> UPTIME alert for device "@Model.Site_Name" </text> break; }
Conditional Message Template
@switch (Model.AlertType) { case Dotcom.Reporting.Common.NotificationType.Error: <text> Device: "@Model.Site_Name" AlertType: Error </text> break; case Dotcom.Reporting.Common.NotificationType.Uptime: <text> Device: "@Model.Site_Name" AlertType: Uptime </text> break; }