Watch Monitor
  • 26 Jun 2020
  • 6 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Watch Monitor

  • Dark
    Light
  • PDF

API's Exposed For Watch Monitor

Using the API’s exposed for Watch monitor you can Create / Delete / Update Watch monitor and also you can perform some operations like Enabling / Disabling Watch monitor.

Create / Delete / Update A Watch Monitor Using API

1. Create a Watch Monitor

API Suffix and Method

Suffix : /WatchMonitors
Method : POST

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

Request Body Format

{
  "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "name": "string",
  "description": "string",
  "isEnabled": true,
  "compositeApplicationId": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "notificationChannelNames": [
    "string"
  ],
  "timeZone": "string",
  "recipients": "string",
  "frequency": 0
}
Mandatory Fields

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

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

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

2. Update A Watch Monitor

API Suffix and Method

Suffix : /WatchMonitors
Method : PUT

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

Request Body Format

{
  "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "name": "string",
  "description": "string",
  "isEnabled": true,
  "compositeApplicationId": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "notificationChannelNames": [
    "string"
  ],
  "timeZone": "string",
  "recipients": "string",
  "frequency": 0
}
Mandatory fields

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

Response Body
Response Body contains the Id of the Updated Watch Monitor.

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

3. Delete A Watch Monitor

API Suffix and Method

Suffix : /WatchMonitors/{watchMonitorId}
Method : DELETE

This API can be used to delete an existing Watch Monitor in Serverless360 composite application.
Request Body Format

watchMonitorId should be passsed in the Suffix URL 

Response Body

"Watch monitor [WatchMonitorName] deleted successfully"

Get Watch Monitors

1. Get Watch Monitors in a Composite Application

API Suffix and Method

Suffix : /WatchMonitors/{compositeApplicationId}
Method : GET

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

Request Body Format

compositeApplicationId should be passsed in the Suffix URL 

Response Body
Response Body contains all the Watch monitor details in the given Composite application Id.

[
  {
    "id": "c7860852-e7ba-432b-bb1e-dd00f8e077bd",
    "name": "Watch Monitor",
    "description": "Watch Monitor can alert on failure of Logic app or Azure function in near real time",
    "isEnabled": false,
    "compositeApplicationId": "3a4b0c02-2ceb-46cf-ad62-8c2a60f936ca",
    "notificationChannelNames": [],
    "timeZone": "(GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London",
    "recipients": "priyalatha.subramanian@kovai.co",
    "frequency": 5
  }
]

2. Get Watch Monitor By Id

API Suffix and Method

Suffix : /WatchMonitors/GetWatchMonitorById/{watchMonitorId}
Method : GET

This API can be used to get individual Watch monitor using the unique WatchMonitorId.

Request Body Format

watchMonitorId should be passsed in the Suffix URL 

Response Body
Response Body contains properties of the given Watch Monitor Id.

{
  "id": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "name": "watchMonitorName",
  "description": "",
  "isEnabled": false,
  "compositeApplicationId": "3a4b0c02-2ceb-46cf-ad62-8c2a60f936ca",
  "notificationChannelNames": [],
  "timeZone": "(GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London",
  "recipients": "",
  "frequency": 10
}

Enable / Disable Watch Monitors

1. Enable Watch Monitor

API Suffix and Method

Suffix : /WatchMonitors/{watchMonitorId}/Enable
Method : PUT

This API can be used to enable a Watch Monitor which is already created in Serverless360.

Request Body Format

watchMonitorId should be passsed in the Suffix URL 

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

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

2. Disable Watch Monitor

API Suffix and Method

Suffix : /WatchMonitors/{watchMonitorId}/Disable
Method : PUT

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

Request Body Format

watchMonitorId should be passsed in the Suffix URL 

Response Body
Response Body contains the Watch monitor Id which was disabled.

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

Mapping a Resource to Watch Monitor

Serverless360 provides four API's to map a resource to Watch Monitor. Two API's use the Azure Resource Id, and the other two use the Resource Id generated in Serverless360.

1. Map a Resource (Logic App or Function App) to Watch Monitor using Resource Id

API Suffix and Method

Suffix : /WatchMonitors/Resource/MapResource
Method : POST

This API can be used to map a resource (Logic App or Function App) in Serverless360 Watch Monitor using the unique Resource Id generated for each resource in Serverless360.

Request Body Format

{
  "watchMonitorId": "0151fbf7-b6e0-44c9-98e6-def2aaf0a70c",
  "resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba",
  "reasons": [
    "string"
  ],
  "functionNames": [
    "string"
  ]
}
Mandatory Fields

"watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba"
"resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba0"
"functionNames": [
"string"
]

  • If the type of the resource used is Function App, function names becomes mandatory

Response Body

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

2. Map a SQL Database Query to Watch Monitor using Resource Id

API Suffix and Method

Suffix : /WatchMonitors/Resource/MapSqlDatabaseQuery
Method : POST

This API can be used to map a SQL Database Query in Serverless360 Watch Monitor using the unique Resource Id generated for a SQL Database in Serverless360.

Request Body Format

{
  "watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba",
  "resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba0",
  "friendlyName": "string",
  "query": "string",
  "warningCondition": "string",
  "warningThreshold": 0,
  "errorCondition": "string",
  "errorThreshold": 0
}
Mandatory Fields

"watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba"
"resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba0"
"friendlyName": "string",
"query": "string",
"warningCondition": "string",
"warningThreshold": 0,
"errorCondition": "string",
"errorThreshold": 0

Response Body

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

3. Map a Resource (Logic App or Function App) to Watch Monitor using Azure Resource Id

API Suffix and Method

Suffix : /WatchMonitors/Resource/MapResourceUsingAzureResourceId
Method : POST

This API can be used to map a resource (Logic App or Function App) in Serverless360 Watch Monitor using the Azure Resource Id.

Request Body Format

{
  "watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba",
  "azureResourceId": "string",
  "reasons": [
    "string"
  ],
  "functionNames": [
    "string"
  ]
}
Mandatory Fields

"watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba"
"resourceId": "b5a90529-a042-4e19-b9fa-bf446c242eba0"
"functionNames": [
"string"
]

  • If the type of the resource used is Function Apps, functionNames becomes mandatory

Response Body

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

2. Map a SQL Database Query to Watch Monitor using Azure Resource Id

API Suffix and Method

Suffix : /WatchMonitors/Resource/MapSqlDatabaseQuery
Method : POST

This API can be used to map a SQL Database Query in Serverless360 Watch Monitor using the Azure Resource Id.

Request Body Format

{
  "watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba",
 "azureResourceId": "string",
  "friendlyName": "string",
  "query": "string",
  "warningCondition": "string",
  "warningThreshold": 0,
  "errorCondition": "string",
  "errorThreshold": 0
}
Mandatory Fields

"watchMonitorId": "0b5a90529-a042-4e19-b9fa-bf446c242eba"
"azureResourceId": "string",
"friendlyName": "string",
"query": "string",
"warningCondition": "string",
"warningThreshold": 0,
"errorCondition": "string",
"errorThreshold": 0

Response Body

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

Unmapping a Resource from a Watch Monitor

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

1. Unmapping a Resource from a Watch Monitor using Resource Id

API Suffix and Method

Suffix : /WatchMonitors/{watchMonitorId}/Resource/{resourceId}/UnmapResource
Method : POST

This API can be used to unmap a resource in Serverless360 Watch Monitor using the unique Resource Id generated for each resource in Serverless360.

Request Body Format

watchMonitorId 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 Watch Monitor using Azure Resource Id

API Suffix and Method

Suffix : /WatchMonitors/{watchMonitorId}/Resource/UnmapResource : POST

This API can be used to unmap a resource in Serverless360 Watch Monitor using the Azure Resource Id.

Request Body Format

watchMonitorId 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