LogicMonitor seeks to disrupt AI landscape with $800M strategic investment at $2.4B valuation to revolutionize data centers.

Learn More

Adding Escalation Chain

Last updated on 07 October, 2024

You can use LogicMonitor REST API v3 to add escalation chain. You must authenticate yourself before making the API request.

URI: POST /setting/alert/chains

ParameterTypeDescription
throttlingAlertsIntegerIf enableThrottling is set to true, then throttlingAlerts indicates the maximum number of alerts that can be send during the throttling period.
Example – “throttlingAlerts”: 40
enableThrottlingBooleanIndicates whether or not throttling (rate limiting) is enabled for this escalation chain. If the field is set to true, then throttlingPeriod and throttlingAlerts indicate how alerts are throttled.
Example – “enableThrottling”: false
destinations(Mandatory) The destination consists of the following:
  • period – the list of week day of this period (weekDays), the timezone for this period (timezone), the start and end minute of this period (startMinutes and endMinutes).
  • stages – It consists of typemethodcontact, and addr. See the description of the ccDestinations field.
  • type – It indicates the type of stages in this chain. The values can be timebased or simple 
nameString(Mandatory) The name of the escalation chain.
Example – “name”: ”MyEscalationChain”
descriptionStringThe description of the escalation chain.
ccDestinationsThe ccDestination consists of the recipient’s details:
  • type – (Mandatory) Supported recipient types are GROUPARBITRARY, and ADMIN. Here, ADMIN indicates a user and ARBITRARY indicates an arbitrary email.
  • method – (Mandatory) Supported methods are EMAILsmsEMAILVOICE, and SMS. The method varies as per the recipient type.
    ARBITRARY – Use email
    ADMIN – Use EMAILsmsEMAILVOICESMS. If a method is not provided, then the default method EMAIL is used.
    GROUP – Does not require a method
  • contact – It includes the email address or phone number of the recipients.
  • addr – If the type is Admin provide the username, and if the type is Arbitrary provide the email address of the recipients.
throttlingPeriodIntegerThe throttling (rate limit) period in minutes if enableThrottling is set to true.
Example – “throttlingPeriod”: 30

The following Python script adds an escalation chain ‘DBTeam’ to the account api.logicmonitor.com, where the escalation chain has a single stage for the db team recipient group:

#!/bin/env python
 
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass
 
#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'apiAccount'  
 
#Request Info
httpVerb ='POST'
resourcePath = '/setting/alert/chains'
data='{"name":"DBTeam","destinations":[{"type":"single","stages":[[{"type":"group","addr":"dbTeam"}]]}]}'
 
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath
 
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
 
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
 
#Construct signature
digest = hmac.new(
        AccessKey.encode('utf-8'),
        msg=requestVars.encode('utf-8'),
        digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')   
 
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'} 
 
#Make request
response = requests.post(url, data=data, headers=headers)
 
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Python 3