Threshold Monitor
  • 26 Jun 2020
  • 7 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Threshold Monitor

  • Dark
    Light
  • PDF

API’s Exposed For Threshold Monitor

Using the API’s exposed for Threshold monitor you can Create / Delete / Update Threshold monitor and also you can perform some operations like Enabling / Disabling threshold monitor, Mapping / Unmapping resources to a threshold monitor.

Create / Delete / Update A Threshold Monitor Using API

1. Create a Threshold Monitor

API Suffix and Method

Suffix : /ThresholdMonitors
Method : POST

This API can be used to create a Threshold Monitor in Serverless360.

Request Body Format

{
  "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "name": "string",
  "description": "string",
  "isEnabled": true,
  "compositeApplicationId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
  "notificationChannelNames": [
    "string"
  ],
  "timeZone": "string",
  "recipients": "string",
  "alertOnCompliance": true,
  "alertOnAutoCorrect": true,
  "daysOfWeek": [
    "string"
  ],
  "startTime": "2020-05-27T14:38:15.096Z",
  "endTime": "2020-05-27T14:38:15.096Z",
  "alertsPerViolation": 0
}
Mandatory Fields

"name": "string"
"compositeApplicationId": "b5a90529-a042-4e19-b9fa-bf446c242eba"
"alertsPerViolation": 0

Response Body
The Response Body contains the unique ThresholdMonitorId for the newly created Threshold Monitor. Later this Id can be used to update / delete or Enable / Disable this Threshold Monitor.

0151fbf7-b6e0-44c9-98e6-def2aaf0a70c

2. Update A Threshold Monitor

API Suffix and Method

Suffix : /ThresholdMonitors
Method : PUT

This API can be used to update an existing Threshold Monitor.

Request Body Format

{
  "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "name": "string",
  "description": "string",
  "isEnabled": true,
  "compositeApplicationId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
  "notificationChannelNames": [
    "string"
  ],
  "timeZone": "string",
  "recipients": "string",
  "alertOnCompliance": true,
  "alertOnAutoCorrect": true,
  "daysOfWeek": [
    "string"
  ],
  "startTime": "2020-05-27T14:38:15.104Z",
  "endTime": "2020-05-27T14:38:15.104Z",
  "alertsPerViolation": 0
}
Mandatory fields

"id": "b5a90529-a042-4e19-b9fa-bf446c242eba" (Threshold Monitor Id)
"name": "string" (Threshold Monitor Name)
"compositeApplicationId": "b5a90529-a042-4e19-b9fa-bf446c242eba"
"alertsPerViolation": 0

Response Body
Response Body contains the Id of the updated Threshold Monitor

0151fbf7-b6e0-44c9-98e6-def2aaf0a70c

3. Delete A Threshold Monitor

API Suffix and Method

Suffix : /ThresholdMonitors/{thresholdMonitorId}
Method : DELETE

This API can be used to Delete an Existing Threshold Monitor in Serverless360 composite application.
Request Body Format

thresholdMonitorId should be passsed in the Suffix URL 

Response Body

"Threshold monitor [ThresholdMonitorName] deleted successfully"

Get Threshold Monitors

1. Get Threshold Monitors in a Composite Application

API Suffix and Method

Suffix : /ThresholdMonitors/{compositeApplicationId}
Method : GET

This API can be used to get all the Threshold Monitor in a particular composite application.

Request Body Format

compositeApplicationId should be passsed in the Suffix URL 

Response Body
Response Body contains all the threshold monitor details in the given composite application Id.

[
  {
    "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
    "name": "thresh",
    "description": "",
    "isEnabled": false,
    "compositeApplicationId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
    "notificationChannelNames": [],
    "timeZone": "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",
    "recipients": "",
    "alertOnCompliance": false,
    "alertOnAutoCorrect": false,
    "daysOfWeek": [],
    "startTime": "2000-03-09T18:30:00Z",
    "endTime": "2000-03-10T18:29:00Z",
    "alertsPerViolation": 0
  }
]

2. Get Threshold Monitor By Id

API Suffix and Method

Suffix : /ThresholdMonitors/GetThresholdMonitorById/{ThresholdMonitorId}
Method : GET

This API can be used to get individual threshold monitor using the unique ThresholdMonitorId.

Request Body Format

ThresholdMonitorId should be passsed in the Suffix URL 

Response Body
Response Body contains the Details and Properties of the given Threshold Monitor Id.

{
  "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "name": "NameOfThresholdMonitor",
  "description": "",
  "isEnabled": false,
  "compositeApplicationId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
  "notificationChannelNames": [],
  "timeZone": "(GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London",
  "recipients": "",
  "alertOnCompliance": false,
  "alertOnAutoCorrect": false,
  "daysOfWeek": [],
  "startTime": "2000-03-09T18:30:00Z",
  "endTime": "2000-03-10T18:29:00Z",
  "alertsPerViolation": 1
}

Enable / Disable Threshold Monitors

1. Enable Threshold Monitor

API Suffix and Method

Suffix : /ThresholdMonitors/{thresholdMonitorId}/Enable
Method : PUT

This API can be used to Enable a Threshold Monitor which is already created in Serverless360.

Request Body Format

thresholdMonitorId should be passsed in the Suffix URL 

Response Body
Response Body contains the Threshold monitor Id which was enabled.

"0151fbf7-b6e0-44c9-98e6-def2aaf0a70c0"

2. Disable Threshold Monitor

API Suffix and Method

Suffix : /ThresholdMonitors/{thresholdMonitorId}/Disable
Method : PUT

This API can be used to disable a Threshold Monitor which is already created in Serverless360.

Request Body Format

thresholdMonitorId should be passsed in the Suffix URL 

Response Body
Response Body contains the Threshold monitor Id which was Disabled.

"0151fbf7-b6e0-44c9-98e6-def2aaf0a70c"

Get Configurable Properties for specified Resource Type

API Suffix and Method

Suffix : /ThresholdMonitors/GetConfigurableProperties/{resourceType}
Method : GET

This API can be used to get the configuration property for specific resource type by providing the specific resource type.

Request Body Format

resourceType should be passsed in the Suffix URL 

In Resource Type always use plural form, like Logicapps, webapps, functionapps, datafactories, etc.

Response Body
In the Response Body you will get the Configurable Properties for the specified resource type.

[
  {
    "id": "b5a90529-a042-4e19-b9fa-bf446c242eba",
    "resourceTypeId": 30,
    "propertyName": "Total Resource Count",
    "condition": ">",
    "warningLevel": 5,
    "errorLevel": 10,
    "expectedState": 0,
    "metricKey": "totalResourceCount",
    "propertyType": 1,
    "isComposite": false
  },
  {
    "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
    "resourceTypeId": 30,
    "propertyName": "Max Allowed Factory Size(Gb)",
    "condition": ">",
    "warningLevel": 5,
    "errorLevel": 10,
    "expectedState": 0,
    "metricKey": "maxAllowedFactorySizeInGbUnits",
    "propertyType": 1,
    "isComposite": false
  },
  {
    "id": "b5a90529-a042-4e19-b9fa-bf446c242eba",
    "resourceTypeId": 30,
    "propertyName": "State",
    "condition": ">",
    "warningLevel": 5,
    "errorLevel": 10,
    "expectedState": 0,
    "metricKey": "runtimeState",
    "propertyType": 2,
    "isComposite": true
  },
  {
    "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
    "resourceTypeId": 30,
    "propertyName": "Max Allowed Resource Count",
    "condition": ">",
    "warningLevel": 5,
    "errorLevel": 10,
    "expectedState": 0,
    "metricKey": "maxAllowedResourceCount",
    "propertyType": 1,
    "isComposite": false
  },
  {
    "id": "b5a90529-a042-4e19-b9fa-bf446c242eba",
    "resourceTypeId": 30,
    "propertyName": "Factory Size(Gb)",
    "condition": ">",
    "warningLevel": 5,
    "errorLevel": 10,
    "expectedState": 0,
    "metricKey": "factorySizeInGbUnits",
    "propertyType": 1,
    "isComposite": false
  }
]

Mapping a Resource To Threshold Monitor

Serverless360 provides two APIs for Mapping a resource to a threshold monitor. One uses the Azure Resource Id, another uses the Resource Id generated in Serverless360.

1. Map a Resource to a Threshold Monitor using Resource Id

API Suffix and Method

Suffix : /ThresholdMonitors/Resource/MapResoure
Method : POST

This API can be used to map a resource in Serverless360's Threshold Monitor using the unique Resource Id generated for each resource in Serverless360 whenever a resource is mapped to any composite application.

Request Body Format

{
  "monitorId": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
  "monitorStateconfiguration": {
    "expectedState": "string"
  },
  "propertyConfigurations": [
    {
      "property": "string",
      "warningThreshold": 0,
      "condition": "string",
      "errorThreshold": 0
    }
  ],
  "subResourceProperties": [
    {
      "resourceName": "string",
      "monitorStateconfiguration": {
        "expectedState": "string"
      },
      "propertyConfigurations": [
        {
          "property": "string",
          "warningThreshold": 0,
          "condition": "string",
          "errorThreshold": 0
        }
      ]
    }
  ]
}
Mandatory Fields

"monitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba"
"resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba0"
"resourceName": "string"
"propertyConfigurations": [
{
"property": "string",
"warningThreshold": 0,
"condition": "string",
"errorThreshold": 0
}
]
"monitorStateconfiguration": {
"expectedState": "string"
}

  • If propertyConfiguration parameter is used all its sub-parameters becomes mandatory

  • If monitorStateconfiguration parameter is used, expected state becomes mandatory

Response Body

{ResourceType} {resourceName} has been mapped to the {monitortype}  monitor {MonitorName} successfully.

2. Map a Resource to a Threshold Monitor using Azure Resource Id

API Suffix and Method

Suffix : /ThresholdMonitors/Resource/MapResoure
Method : POST

This API can be used to map a resource in Serverless360's Threshold Monitor using the Azure Resource Id generated for each resource whenever a resource is created in the Azure Portal.

Request Body Format

{
  "monitorId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
  "azureResourceId": "string",
  "monitorStateconfiguration": {
    "expectedState": "string"
  },
  "propertyConfigurations": [
    {
      "property": "string",
      "warningThreshold": 0,
      "condition": "string",
      "errorThreshold": 0
    }
  ],
  "subResourceProperties": [
    {
      "resourceName": "string",
      "monitorStateconfiguration": {
        "expectedState": "string"
      },
      "propertyConfigurations": [
        {
          "property": "string",
          "warningThreshold": 0,
          "condition": "string",
          "errorThreshold": 0
        }
      ]
    }
  ]
}
Mandatory Fields

"monitorId": "b5a90529-a042-4e19-b9fa-bf446c242eba0"
"azureResourceId": "string"
"property": "string"
"warningThreshold": 0
"condition": "string"
"errorThreshold": 0
"resourceName": "string"
"propertyConfigurations": [
{
"property": "string",
"warningThreshold": 0,
"condition": "string",
"errorThreshold": 0
}
]
"monitorStateconfiguration": {
"expectedState": "string"
}

  • If propertyConfiguration parameter is used all its sub-parameters becomes mandatory

  • If monitorStateconfiguration parameter is used, expected state becomes mandatory

Reference link for How to get Azure Resource Id? can be used to retrieve the Azure Resource Id

Response Body

{ResourceType} {resourceName} has been mapped to the {monitortype}  monitor {MonitorName} successfully.

Unmapping a Resource from a Threshold Monitor

Again Serverless360 provides two APIs for Unmapping a resource from a threshold monitor. One uses the Azure Resource Id, another uses the Resource Id generated in Serverless360.

1. Unmap a Resource From a Threshold Monitor using Resource Id

API Suffix and Method

Suffix : /ThresholdMonitors/{monitorId}/Resource/{resourceId}/UnMapResource
Method : POST

This API can be used to unmap a resource in Serverless360's Threshold Monitor using the unique Resource Id generated for each resource in Serverless360 whenever a resource is mapped to any composite application.

Request Body Format

monitorId and resourceId should be passsed in the Suffix URL 

Response Body

The {res type} ‘{res name}’ was unmapped from the {monitor type} monitor ‘{monitor name}’ successfully

2. Unmap a Resource From a Threshold Monitor using Azure Resource Id

API Suffix and Method

Suffix : /ThresholdMonitors/{monitorId}/Resource/UnMapResource
Method : POST

This API can be used to unmap a resource in Serverless360's Threshold Monitor using the Azure Resource Id generated for each resource whenever a resource is created in the Azure Portal.

Request Body Format

monitorId should be passsed in the Suffix URL and azureResourceId should be given in Request Body 

Response Body

The {res type} ‘{res name}’ was unmapped from the {monitor type} monitor ‘{monitor name}’ successfully
We'd love to hear your thoughts
Please visit our feedback system to suggest new Features or Enhancements. You can also take a look at our Roadmap

Was this article helpful?

What's Next