Alert Template can be personalized by including dynamic variables that are turned to the current system values upon sending an alert. 

Syntax of Dynamic Templates

Dotcom-Monitor supports dynamic templates built upon Microsoft’s Razor parsing engine. Introduction to Razor syntax can be found here

A dynamic template’s script must be started with the following line:

@*dotcom razor engine version=1.0*@

Dotcom-Monitor ObjectModel

Find the Dotcom-Monitor ObjectModel class diagram with the classes source code below. Use the attributes as dynamic variables in the Alert Template script. 

  • Dotcom-Monitor ObjectModel

  • MVTemplateModel (MetricsView Platform)

  • SVTemplateModel (ServerView Platform)

  • UVTemplateModel (UserView/BrowserView Platform)

  • Response

  • Device

  • Monitor

  • Task

Examples of Alert Templates

For example, let’s create a sample of a basic alert template:

@*dotcom razor engine version=1.0*@
{
"devicename" : "@Model.Site_Name",
"taskName" : "@Model.FirstErrorResponse.Task.Name",
"error" : "Error Type:@Model.FirstErrorResponse.AllErrors[0].ErrorType;Error Code:@Model.FirstErrorResponse.AllErrors[0].ErrorCode;Reason:@Model.FirstErrorResponse.AllErrors[0].Reason",
"StartMonitorDowntime" : @(((long)Model.StartMonitorDowntime.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds))
}

In this case, the result alert will have the following layout:

Subject: DOTCOM-MONITOR: Problem found in bbc.com device

{

"devicename" : "bbc.com",

"taskName" : "http://bbc.com",

"error" : "Error Type:Validation;Error Code:300;Reason:Task maximum timeout expired. Configured Timeout: 0.010 sec. Actual Response: 13.125 sec.", "StartMonitorDowntime" : 1558991488950 }

Find more examples for the different monitoring platfoms’ tasks below.

  • UserView/BrowserView Device

  • ServerView Device

  • MetricsView Device

For more real examples or questions, create a ticket.