Alarms

With “Alarms” ServisBOT provides live monitoring of Bot experiences with real time bot metrics & business goals. Metrics can be evaluated as frequently at 15 minutes or 1 hour intervals. A schedule can be set to cover each hour and day of the week. And when an alarm triggered, users subscribed to the alarm will be notified.

Alarms can be used for many use cases i.e.

  1. alarm when bot is being under used
  2. alarm when there is an anomaly in understanding (high level of missed input)
  3. alarm when a specific intent is trending abnormally high for the day of the week

Alarm Commands

It is possible to perform actions associated with alarms in the cli by using sb-cli alarm <command>. The possible commands are listed below.

sb-cli alarm create <json>                Creates an alarm from inline JSON or a file
                                          [aliases: c]

sb-cli alarm delete <alarm_id>            Deletes an alarm with the given alarm ID
                                          [aliases: d]

sb-cli alarm describe <alarm_id>          Describes an alarm with the given alarm ID
                                          [aliases: desc]

sb-cli alarm list [type]                  Lists all alarm ids, display names, and descriptions
                                          [aliases: l]

sb-cli alarm trigger-subscriptions        Triggers all the subscriptions for
<alarm_id>                                an alarm with the given alarm id, as if it had alarmed
                                          [aliases: trigger]
                                          
sb-cli alarm update <json>                Updates an alarm from inline JSON or a file 
                                          [aliases: u]

Examples

To create an alarm using the CLI command sb-cli alarm create <json> you must either create the alarm from an inline JSON, or enter the relevant file path. The JSON should be formatted as follows:

{
   "displayName": "exampleAlarm",                
   "enabled": true,                              
   "description": "my example alarm",  
   "projects": [],      
   "frequency": "15mins",                        
   "query": {
    "responsePath": "businessGoalMetricsTotals.conversation_engaged.count",
    "goal": "conversation_engaged",
    "resourceName": "BotName",
    "resourceType": "Bot",
    "metricType": "BusinessGoals"
  },                                  
   "scheduleConfig": {
        "timezone": "Europe/Dublin",
        "schedule": {
            "wednesday": {
                "9-10": {
                    "min": 0,
                    "max": 0
                },
                "14": {
                    "min": 0,
                    "max": 0
                }
            }
        }
    },                        
}

The table below describes which fields are required.

Field Required or Optional
displayName Required Human readable name, accepts spaces.
enabled Optional (default true) True or false
description Optional Internal values
projects Required A reference to a project in the same org that will be checked
frequency Required How often the alarm should run. hourly or 15mins. Make sure the schedule’s min and max data are appropriate for the data expected for your total period.
query Required Query run to check the alarm, only business goal calculation are supported. If the buisness goal has a space in it, include that space here. For example, "businessGoalMetricsTotals.My Goal.count" and "My Goal".
scheduleConfiq Required Schedule - an object containing the alarm schedule configuration.

After creation the alarm will have an autogenerated ‘id’ field which is required to subscribe to the alarm

ScheduleConfig

Each key in this object can be a day of the week in long form. Possible values are

  • ‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’, ‘Sunday’
  • Within each day of the week object you can define the hours for which you want the alarm to be processed. Possible values for hours are 0-23 where ‘0’ is midnight, and ‘23’ is 11pm.
  • You may also specify a range of hours in the same way. For example, ‘8-11’ would be the same as adding identical config for ‘8’, ‘9’, ‘10’ and ‘11’.
  • You should not specify leading zeroes on hours below 10. For example, if you want to run an alarm at 3am you should specify ‘3’ and not ‘03’.
  • Within each hour object you can define statistic functions that should be run for this period. The possible statistic functions are as follows:
    • ‘Max’ - A number, which is checked against the metric value. If the metric value is greater than the defined max value the alarm will alert the subscribers.
    • ‘Min’ - A number, which is checked against the metric value. If the metric value is less than the defined min value the alarm will alert the subscribers.

Subscribing to an alarm

To subscribe to an alarm a project must be first setup.

To setup a project use the sb-cli project create command with a json file detailing the project.

Example:

{
 "Alias": "my_first_project",
 "Configuration": {
  "Monitoring": {
   "Alarms": [
    {
     "Id": "alarm_id", // The autogenerated id field of the alarm   
     "Subscribers": [
      {
       "Properties": {
        "Body": "<h2>ServisBOT Alert</h2>{Description}<br><body>AlarmId: {AlarmId}<br>AlarmState: {AlarmState}<br>PreviousState: {PreviousState}<br>MetricValue: {MetricValue}</body>",
        "Emails": [
         "your_email@email.com"
        ],
        "Subject": "ServisBOT Alarm - {AlarmId}: {AlarmState}"
       },
       "Type": "Email"
      }
     ]
    }
   ]
  }
 },
 "Version": "$LATEST"
}

After the project is created update the alarm with a projects key as follows:

{
   "id": "alarm_id", // autogenerated field
   "displayName": "exampleAlarm",                
   "enabled": true,                              
   "description": "my example alarm",            
   "projects": [
        {"name": "my_first_project"}
   ],         
   "frequency": "15mins",                        
   "query": {
        "responsePath": "businessGoalMetricsTotals.conversation_engaged.count",
        "goal": "conversation_engaged",
        "resourceName": "BotName",
        "resourceType": "Bot",
        "metricType": "BusinessGoals"
   },                                  
   "scheduleConfig": {
        "timezone": "Europe/Dublin",
        "schedule": {
            "wednesday": {
                "9": {
                    "min": 0,
                    "max": 0
                },
                "10": {
                    "min": 0,
                    "max": 0
                }
            }
        }
    },                        
}