Application Monitor
Application Information Management API
Application Creation API
Request structure
Method:POST
Url:/csm/api/v1/userId/{userId}/application
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| name | String | Application Name | Yes |
| alias | String | Application Alias | No |
| type | String | Types | Yes |
| description | String | Description | No |
Request example
POST /csm/api/v1/userId/user1/application
Host: bcm.bj.baidubce.com:80
{
"type": "BCC",
"name": "test12",
"alias": "testAlias",
"description": "fafda",
"userId":"123456"
}Request Response
{
"id": 1,
"name": "test",
"alias": "testAlias",
"type": "BCC",
"userId": "user1",
"description": "test"
}Application List API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| searchName | String | Application Name or Alias, used for search | No |
| pageNo | Int | Page number, defaulting to 1 | Yes |
| pageSize | Int | Page size, defaulting to 10 | Yes |
Request example
GET /csm/api/v1/userId/user1/application?searchName=te&pageNo=0&pageSize=10
Host: bcm.bj.baidubce.com:80
Response example
{
"content":[
{
"id":1,
"name":"test",
"alias":"testAlias",
"type":"BCC",
"userId":"user1",
"description":"test"
}
],
"totalElements":1,
"totalPages":1,
"size":10
}Application Edit API
Request structure
Method:PUT
URI: /csm/api/v1/userId/{userId}/application
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| id | Int | Application ID | Yes |
| name | String | Application Name | Yes |
| alias | String | Application Alias | No |
| type | String | Application Type | Yes |
| userId | String | User ID | Yes |
| description | String | Application Description | No |
API description
Only alias and description are allowed to be modified; other fields are not editable.
Request example
PUT /csm/api/v1/userId/user1/application
Host: bcm.bj.baidubce.com:80
{
"id": 1,
"name": "test",
"alias": "testAlias3",
"type": "BCC",
"userId": "user1",
"description": "test"
}Response example
{
"id": 1,
"name": "test",
"alias": "testAlias3",
"type": "BCC",
"userId": "user1",
"description": "test"
}Application Deletion API
Request structure
Method:DELETE
URI: /csm/api/v1/userId/{userId}/application
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| name | String | Application Name | Yes |
Request example
DELETE /csm/api/v1/userId/user1/application
Host: bcm.bj.baidubce.com:80
{
"name": "test"
}Response example
HTTP 200Application Instance Management API
Instance List API When Creating an Instance
Request structure
Method:POST
URI: /csm/api/v1/userId/{userId}/application/instance/all
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| region | String | Region | Yes |
| appName | String | Application Name | Yes |
| searchName | String | Search key, currently supports host name, host ID, and internal IP search, with values being “name", "instanceId", and "internalIp" respectively | Yes |
| searchValue | String | Search Content | No |
| pageSize | Int | Page size | Yes |
| pageNo | Int | Page No. | Yes |
Request example
POST /csm/api/v1/userId/user1/instances/all
Host: bcm.bj.baidubce.com:80
{
"pageSize": 50,
"pageNo": 1,
"searchName": "name",
"searchValue": "instance-0eseehvy",
"region": "bj",
"appName": "test"
}Response example
{
"content":[
{
"id":"387838",
"instanceId":"i-DvbyV9Lw",
"instanceUuid":"63deee8a-5ddb-4944-80fa-faa144825a65",
"name":"instance-0eseehvy",
"internalIp":"192.168.16.227",
"floatingIp":"100.88.66.222",
"publicIp":null,
"hasBinded":false
},
{
"id":"1258",
"instanceId":"i-aztzAEUk",
"instanceUuid":"50fb04a1-7adf-4769-b957-bf40b40d6b02",
"name":"instance-3k4ol2fr",
"internalIp":"192.168.16.39",
"floatingIp":"100.88.66.130",
"publicIp":null,
"hasBinded":false
},
{
"id":"385510",
"instanceId":"i-s6r0Y8xM",
"instanceUuid":"125b9e28-ecc4-4ec7-b584-6d65c743c153",
"name":"instance-u3ahll4c-1",
"internalIp":"192.168.16.225",
"floatingIp":"100.88.67.8",
"publicIp":null,
"hasBinded":false
},
{
"id":"385511",
"instanceId":"i-iTPduQhx",
"instanceUuid":"e1f0d8bb-845d-44ab-bc7c-08a8efccb8a0",
"name":"instance-u3ahll4c-2",
"internalIp":"192.168.16.226",
"floatingIp":"100.88.67.80",
"publicIp":null,
"hasBinded":false
}
],
"query":null,
"fields":[
],
"orderBy":[
],
"pageNumber":1,
"pageSize":50,
"pageElements":4,
"last":true,
"first":true,
"totalPages":1,
"totalElements":4
}Create instance APIs
Request structure
Method:POST
URI: /csm/api/v1/userId/{userId}/application/instance/bind
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| hostList | Instance Collection, where InstanceInfo | Yes |
InstanceInfo
| Name | Types | Description | Required or not |
|---|---|---|---|
| instanceId | String | Long instance ID | Yes |
| region | String | Region | Yes |
Request example
POST /csm/api/v1/userId/123456/application/test14/instance/bind
Host: bcm.bj.baidubce.com:80
{
"appName": "test",
"userId": "453bf9588c9e488f9ba2c9841290****",
"hostList": [
{
"instanceId": "2096290b-5984-4c67-8ccc-864ca5f5****",
"region": "bj"
},
{
"instanceId": "7d4e09af-d01b-4492-88e9-c27d9096****",
"region": "bj"
}
]
}Request example
trueCreated Instance List API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/instance/list
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| region | String | Search by region, filter instances in that region | No |
Request example
GET /csm/api/v1/userId/user1/application/test/instance/list?region=bj
Host: bcm.bj.baidubce.com:80Response example
[
{
"id": 1,
"name": "0.test",
"offset": 0,
"instanceId": "instance1",
"region": "bj",
"userId": "user1",
"appName": "test"
},
{
"id": 2,
"name": "1.test",
"offset": 1,
"instanceId": "instance2",
"region": "bj",
"userId": "user1",
"appName": "test"
}
]Delete instance APIs
Request structure
Method:DELETE
URI: /csm/api/v1/userId/{userId}/application/instance
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| appName | String | Application Name | Yes |
| id | String | ID of the Instance in the database | Yes |
Request example
DELETE /csm/api/v1/userId/user1/application/instance
Host: bcm.bj.baidubce.com:80
{
"id": 1,
"appName": "test"
}Response example
HTTP 200Monitor Task Management API
Create Monitor Task API
Request structure
Method:POST
URI: /csm/api/v1/userId/{userId}/application/task/create
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| aliasName | String | Task Alias | Yes |
| appName | String | Application Name | Yes |
| type | int | Task type: 0, Process; 1, Port; 2, Log; 3, script | Yes |
| cycle | int | Collection Period, default is 1 minute | No |
| target | String | Target, process path or port or log path or script path | Yes |
| description | String | Application Description | No |
For log tasks, i.e., type=2, the following log-related fields must be appended to the RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| logExample | String | Log Sample | Yes |
| matchRule | String | Log Extraction Rules | Yes |
| rate | int | Collection Rate, in Minutes | Yes |
| extractResult | List |
Extraction Result | Yes |
| metrics | List |
Configure Metric | Yes |
LogExtractResult Parameters
| Name | Types | Description |
|---|---|---|
| extractFieldName | String | Extracted Field Name |
| extractFieldValue | String | Extracted Field Value |
| dimensionMapTable | String | Dimension Mapping Table Name |
Metric Parameters
| Name | Types | Description |
|---|---|---|
| metricName | String | Monitor item name |
| metricAlias | String | Monitor Item Alias |
| metricUnit | String | Monitor Item Unit |
| valueFieldType | int | Field Type for Value Extraction: Value Field: 0, Log Line Count; 1. Single Field; 2. Multiple Fields |
| valueFieldName | String | Value Field |
| aggrTags | List<AggrTag>, where the meanings of AggTag parameters are shown in the table below | Data Dimension |
| saveInstanceData | int | Whether to save Instance Data: 0, No; 1, Yes |
AggTag Parameter
| Field name | Types | Meaning |
|---|---|---|
| range | String | Aggregated Instance Scope, currently only supports App |
| tags | String | Aggregated dimension keys, separated by commas |
Request example 1
POST /csm/api/v1/userId/123456/application/test14/task/create
Host: bcm.bj.baidubce.com:80
{
"aliasName": "agent_test_task",
"type": 0,
"cycle":60,
"target":"/bcm-agent",
"description":"agent task"
}Request response 1
{
"id": 1,
"name": "0ebea6b1efb74867b7bbaa17caa95e7a", // Monitor Task Unique Identifier
"aliasName": "test_task",
"appName": "test14",
"userId": "123456",
"cycle": 60,
"target": "/bcm-agent",
"type": 0,
"description": "test task"
}Request example 2
POST /csm/api/v1/userId/123456/application/test14/task/create
Host: bcm.bj.baidubce.com:80
{
"aliasName": "log_test_task20",
"type": 2,
"cycle": 60,
"target": "/tmp/test.log",
"description": "log task",
"logExample": "10.157.16.207 - - [09/Apr/2020:20:45:33 +0800] \"POST /v1/dashboard/metric/gaugechart HTTP/1.1\" 200 117 47ms",
"matchRule": "800] \"(?P<method>(GET|POST|PUT|DELETE)) .*\/v1\/dashboard\/metric\/(?P<widget>(cycle|trend|report|billboard|gaugechart)) HTTP\/1.1\".*(?P<resTime>[0-9]+)ms",
"rate": 5,
"extractResult": [
{
"extractFieldName": "widget",
"extractFieldValue": "gaugechart",
"dimensionMapTable": "path"
}
],
"metrics": [
{
"metricName": "con_tsdb_time",
"metricAlias": "Response Time”,
"valueFieldName": "resTime",
"aggrTags": [
{
"range": "All",
"tags": "method,widget"
},
{
"range": "All",
"tags": "method"
}
]
}
]
}Request response 2
{
"id": 1,
"name": "79c35af26c4346ab844bcbcdde2875c3",
"aliasName": "log_test_task20",
"type": 2,
"cycle": 60,
"target": "/tmp/test.log",
"description": "log task",
"logExample": "10.157.16.207 - - [09/Apr/2020:20:45:33 +0800] \"POST /v1/dashboard/metric/gaugechart HTTP/1.1\" 200 117 47ms",
"matchRule": "800] \"(?P<method>(GET|POST|PUT|DELETE)) .*\/v1\/dashboard\/metric\/(?P<widget>(cycle|trend|report|billboard|gaugechart)) HTTP\/1.1\".*(?P<resTime>[0-9]+)ms",
"rate": 5,
"extractResult": [
{
"extractFieldName": "widget20",
"extractFieldValue": "gaugechart20",
"dimensionMapTable": "path"
}
],
"metrics": [
{
"metricName": "con_tsdb_time20",
"metricAlias": "Response Time”,
"valueFieldName": "resTime",
"aggrTags": [
{
"range": "All",
"tags": "method,widget"
},
{
"range": "All",
"tags": "method"
}
]
}
]
}Monitor Task Details API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/task/{taskName}
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| taskName | String | Task name | Yes |
Request example 1
GET /csm/api/v1/userId/123456/application/test14/task/2096eb64edaf484cb84eff5ccb33bfd5
Host: bcm.bj.baidubce.com:80Request response 1
{
"id": 2,
"name": "2096eb64edaf484cb84eff5ccb33bfd5",
"aliasName": "2489qhwif384189",
"appName": "test14",
"userId": "123456",
"cycle": 60,
"target": "/python",
"type": 0,
"description": "python task"
}Request example 2
GET /csm/api/v1/userId/123456/application/test14/task/79c35af26c4346ab844bcbcdde2875c3
Host: bcm.bj.baidubce.com:80Request response 2
{
"id": 11,
"name": "79c35af26c4346ab844bcbcdde2875c3",
"aliasName": "log_test_task2",
"appName": "test14",
"userId": "123456",
"cycle": 60,
"target": "/home/work/bcm/csm.log",
"type": 2,
"description": "log task2",
"logExample": "2020-11-12T16:27:08.149+08:00 DEBUG 86884 [csm-saver-1357862653] --- c.b.b.b.s.m.i.TsdbDataPushServiceImpl : [d2b9f42d-4647-4e81-8d7f-e39e3c154552][] dynamic push data result, TsdbRemoteReturnData:",
"matchRule": "(time)(ms)",
"rate": 5,
"extractResult": [
{
"id": 7,
"taskId": 11,
"extractFieldName": "time",
"extractFieldValue": "50",
"dimensionMapTable": null
}
],
"metrics": [
{
"id": 2,
"taskId": 11,
"metricName": "responseTime",
"metricAlias": "Response Time”,
"metricUnit": "ms",
"valueFieldType": 1,
"valueFieldName": "responseTime",
"valueMatchRule": null,
"aggrInstanceRange": "ALL",
"aggrTags": "",
"saveInstanceData": 0
}
]
}Monitor Task List API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/task/list
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| type | int | Task Type: 0, process; 1, port; 2, log; 3, script; used for filtering; | No |
Request example
GET /csm/api/v1/userId/123456/application/test14/task/list?type=1
Host: bcm.bj.baidubce.com:80Request Response
[
{
"id": 4,
"name": "171f6e3052fb414098581f7886d66233",
"aliasName": "port_test_task",
"appName": "test14",
"userId": "123456",
"cycle": 60,
"target": "8855",
"type": 1,
"description": "port task"
}
]Monitor Task Edit API
Request structure
Method:PUT
URI: /csm/api/v1/userId/{userId}/application/task/update
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| Name | Types | Description | Required or not |
| aliasName | String | Task Alias | Yes |
| type | int | Task type: 0, Process; 1, Port; 2, Log | Yes |
| cycle | int | Collection Period, default is 1 minute | No |
| target | String | Target, process path, port, or log path | Yes |
| description | String | Application Description | No |
If type=2, the following fields must be appended to the body
| Name | Types | Description | Required or not |
|---|---|---|---|
| logExample | String | Log Sample | Yes |
| matchRule | String | Log Extraction Rules | Yes |
| rate | int | Collection Rate, in Minutes | Yes |
| extractResult | Extraction Result | Yes | |
| metrics | Configure Metric | Yes |
LogExtractResult Parameters
| Name | Types | Description |
|---|---|---|
| extractFieldName | String | Extracted Field Name |
| extractFieldValue | String | Extracted Field Value |
| dimensionMapTable | String | Dimension Mapping Table Name |
Metric Parameters
| Name | Types | Description |
|---|---|---|
| metricName | String | Monitor item name |
| metricAlias | String | Monitor Item Alias |
| metricUnit | String | Monitor Item Unit |
| valueFieldType | int | Field Type for Value Extraction: Value Field: 0, Log Line Count; 1. Single Field; 2. Multiple Fields |
| valueFieldName | String | Value Field |
| aggrTags | Data Dimension | |
| saveInstanceData | int | Whether to save Instance Data: 0, No; 1, Yes |
Request example
PUT /csm/api/v1/userId/123456/application/test14/task/79c35af26c4346ab844bcbcdde2875c3
Host: bcm.bj.baidubce.com:80
{
"id": 11,
"name": "79c35af26c4346ab844bcbcdde2875c3",
"aliasName": "log_test_task2",
"appName": "test14",
"userId": "123456",
"cycle": 60,
"target": "/home/work/bcm/csm.log",
"type": 2,
"description": "log task update2",
"logExample": "11-12T16:27:08.149+08:00 DEBUG 86884 [csm-saver-1357862653] --- c.b.b.b.s.m.i.TsdbDataPushServiceImpl",
"matchRule": "*",
"rate": 5,
"extractResult": [
{
"extractFieldName": "responseTime2",
"extractFieldValue": "responseTime2",
"dimensionMapTable": "123"
}
],
"metrics": [
{
"metricName": "responseTime2",
"metricAlias": "Response Time-update2",
"metricUnit": "ms",
"valueFieldType": 1,
"valueFieldName": "responseTime2",
"valueMatchRule": null,
"aggrInstanceRange": "ALL",
"aggrTags": "",
"saveInstanceData": 0
}
]
}Request Response
{
"id": 11,
"name": "79c35af26c4346ab844bcbcdde2875c3",
"aliasName": "log_test_task2",
"appName": "test14",
"userId": "123456",
"cycle": 60,
"target": "/home/work/bcm/csm.log",
"type": 2,
"description": "log task update2",
"logExample": "11-12T16:27:08.149+08:00 DEBUG 86884 [csm-saver-1357862653] --- c.b.b.b.s.m.i.TsdbDataPushServiceImpl",
"matchRule": "*",
"rate": 5,
"extractResult": [
{
"extractFieldName": "responseTime2",
"extractFieldValue": "responseTime2",
"dimensionMapTable": "123"
}
],
"metrics": [
{
"metricName": "responseTime2",
"metricAlias": "Response Time-update2",
"metricUnit": "ms",
"valueFieldType": 1,
"valueFieldName": "responseTime2",
"valueMatchRule": null,
"aggrInstanceRange": "ALL",
"aggrTags": "",
"saveInstanceData": 0
}
]
}Monitor Task Deletion API
Request structure
Method:DELETE
URI: /csm/api/v1/userId/{userId}/application/task/delete
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| name | String | Task Name, UUID, not aliasName | Yes |
| appName | String | Application Name | Yes |
Request example
DELETE /csm/api/v1/userId/123456/application/task/delete
Host: bcm.bj.baidubce.com:80
{
"name":"79c35af26c4346ab844bcbcdde2875c3",
"appName":"test14"
}Request Response
HTTP 200Dimension Mapping Table Management API
Dimension Mapping Table Creation
Method:POST
URI: /csm/api/v1/userId/{userId}/application/dimensionMap/create
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| tableName | String | Dimension Mapping Table Name | Yes |
| mapContentJson | String | Dimension Mapping Content | Yes |
Request example
POST /csm/api/v1/userId/123456/application/dimensionMap/create
Host: bcm.bj.baidubce.com:80
{
"userId": "123456",
"appName": "test14",
"mapContentJson": "chinanet=>cn\nchinacom=>cc",
"tableName": "isp"
}Request Response
{
"userId": "123456",
"appName": "test14",
"mapContentJson": "chinanet=>cn\nchinacom=>cc",
"tableName": "isp"
}Dimension Mapping Table Query
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/dimensionMap/list
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| searchName | String | Mapping Table Name Search | No |
Request example
GET /csm/api/v1/userId/123456/application/test14/dimensionMap/list?searchName=is
Host: bcm.bj.baidubce.com:80Request Response
[
{
"userId": "123456",
"appName": "test14",
"mapContentJson": "chinanet=>cn\nchinacom=>cc",
"tableName": "isp"
}
]Dimension Mapping Table Deletion
Request structure
Method:DELETE
URI: /csm/api/v1/userId/{userId}/application/dimensionMap/delete
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| tableName | String | Dimension Mapping Table Name | Yes |
Request example
DELETE /csm/api/v1/userId/123456/application/test14/dimensionMap/ispRequest Response
HTTP 200Dimension Mapping Table Update
Request structure
Method:PUT
URI: /csm/api/v1/userId/{userId}/application/dimensionMap/update
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| tableName | String | Dimension Mapping Table Name | Yes |
| mapContentJson | String | Dimension Mapping Content | Yes |
Request example
PUT /csm/api/v1/userId/123456/application/dimensionMap/update
Host: bcm.bj.baidubce.com:80
{
"userId": "123456",
"appName": "test14",
"mapContentJson": "chinanet=>cn\nchinacom=>cc",
"tableName": "isp"
}Request Response
HTTP 200Monitoring Data Query API
Dimension Value Query API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/task/{taskName}/metricMeta
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| taskName | String | Task name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| instances | String | Multiple instance names, separated by commas | No |
| metricName | String | Metric name | Yes |
| dimensionKeys | String | Dimension keys, multiple keys can be passed, separated by commas | Yes |
Request example
GET /csm/api/v1/userId/a0d04d7c202140cb80155ff7b6******/application/test14/task/79c35af26c4346ab844bcbcdde******/metricMeta?instances=0.test14,1.test14&metricName=log.responseTime&dimensionKeys=method
Host: bcm.bj.baidubce.com:80Request Response
{
"method":[
"GET",
"POST",
"PUT"
]
}Multi-Object Single-Metric Query API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/task/{taskName}/metricData
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| taskName | String | Task name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| instances | String | Multiple instance names, separated by commas. Optional when aggrData is true; mandatory when aggrData is false | No |
| metricName | String | Metric name | Yes |
| cycle | int | Period, default 60s | No |
| startTime | String | UTC Time, Start Time | Yes |
| endTime | String | UTC Time, End Time | Yes |
| dimensions | String | Dimensions, with multiple dimensions separated by commas. For multiple values of the same dimension key, use three underscores to connect the values; example 1: httpMethod:POSTGET, path:apipath1apipath2;Example 2: httpMethod:POST___GET,path:apipath1; Example 3: httpMethod:POST,path:apipath1 | No |
| statistics | String | Statistic method. Possible values:average – average value maximum – maximum value minimum – minimum value sum – sum value sampleCount – sample count |
Yes |
| aggrData | String | Whether to aggregate values: true to obtain aggregated data, default is false | No |
Request example
GET csm/api/v1/userId/a0d04d7c202140cb80155ff7b6******/application/zmq-log-1115/task/6d3f07e6684d47b69ca9600f7f******/metricData?metricName=exec.6d3f07e6684d47b69ca9600f7fcbbb12.metric1&startTime=2023-12-05T09:54:15Z&endTime=2023-12-05T10:04:15Z&instances=0.zmq-log-1115,1.zmq-log-1115&statistics=dss&cycle=120
Host: bcm.bj.baidubce.com:80Request Response
[
{
"namespace": "0.zmq-log-1115",
"dimensions": [],
"dataPoints": [
{
"timestamp": "2023-12-05T09:54:15Z",
"average": 66.0
},
{
"timestamp": "2023-12-05T09:58:15Z",
"average": 66.0
},
{
"timestamp": "2023-12-05T10:02:15Z",
"average": 66.0
}
]
},
{
"namespace": "1.zmq-log-1115",
"dimensions": [],
"dataPoints": [
{
"timestamp": "2023-12-05T09:54:15Z"
},
{
"timestamp": "2023-12-05T09:58:15Z"
},
{
"timestamp": "2023-12-05T10:02:15Z"
}
]
}
]Alarm-related API
Alarm Strategy Creation API
Request structure
Method:POST
URI: /csm/api/v1/userId/{userId}/application/alarm/config/create
RequestBody
| Name | Types | Description |
|---|---|---|
| alarmDescription | String | Automatically generated, alarm rule description |
| alarmName | String | Unique alarm name under userId |
| userId | String | User ID |
| appName | String | Application Name |
| monitorObjectType | MonitorObjectType | Monitor Object Type: When the selected monitor object type is an Instance, the value is APP; when it's an Application, the value is SERVICE. |
| monitorObject | ACMonitorObject | Monitor Object |
| type | AlarmType(enum) | Alarm type: When the monitor object type is selected as Instance, the value is INSTANCE; when the monitor object type is selected as Application, the value is SERVICE |
| level | AlarmLevel(enum) | Alarm Level, divided into five levels: NOTICE, WARNING, CRITICAL, MAJOR, and CUSTOM |
| actionEnabled | Boolean | Alarm notification status |
| policyEnabled | Boolean | Alarm Strategy activation status: true indicates enabled, false indicates disabled. |
| rules | Alarm rule list | |
| incidentActions | Set(String) | Actions to be taken in the alarm status |
| resumeActions | Set(String) | Actions to be taken in the normal status |
| insufficientActions | Set(String) | Actions under insufficient data collection status |
| insufficientCycle | int | No-data alarm judgment period |
| srcName | String | Task identifier, i.e., taskName |
| srcType | String | Task Type, enumeration: PROC (Process), PORT (Port), LOG (Log), SCR (Script) |
| repeatAlarmCycle | int | Alarm Repeat Notification: Interval between repeated alarm triggers |
| maxRepeatCount | int | Alarm Repeat Notification: Maximum repeat notification count |
ACMonitorObject
| Name | Types | Description |
|---|---|---|
| monitorObjectType | MonitorObjectType(enum) | Monitor Object Type: APP or SERVICE. Instance-based Alarm Strategies select APP, while Application-based Alarm Strategies select SERVICE. |
| monitorObjectView | Set(ACMonitorObjectViewModel) | Monitor Object |
ACMonitorObjectViewModel
| Name | Types | Description |
|---|---|---|
| monitorObjectName | String | Monitor Object. When the monitor object type is selected as Instance, pass the taskName; when the monitor object type is selected as Application, pass the Dimension key and value. In this case, rules [0][0]. metricDimensions does not need to be assigned |
| monitorObjectNameView | String | Monitor Object Display Name, shown in Alarm History, etc. |
AlarmRule
| Name | Types | Description |
|---|---|---|
| metric | String | Metric Identifier Name |
| metricAlias | String | Metric Alias |
| cycle | Integer | Interval for evaluating whether each alarm rule is satisfied, i.e., the duration of a single evaluation period, unit: s |
| statistics | String | Statistic method, values: maximum, minimum, sum, and average |
| function | String | Value THRESHOLD, indicating threshold alarm |
| threshold | String | Alarm rule threshold |
| comparisonOperator | String | Operator for threshold comparison, possible values: >=, >, =, <, <= |
| count | Integer | Number of consecutive occurrences required to trigger an alarm |
| metricDimensions | List(ACMetricDimensions) | Metric dimension |
ACMetricDimensions
| Name | Types | Description |
|---|---|---|
| name | String | Metric dimension key |
| value | String | Metric Dimension Value |
Request example
POST /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/alarm/config/create
Host: bcm.bj.baidubce.com:80
{
"alarmDescription": "proc.cpu_usage average value > 90”,
"alarmName":"testAPPalarm",
"userId":"453bf9588c9e488f9ba2c98412******",
"appName":"test14",
"monitorObjectType":"APP",
"monitorObject":{
"id":1
"monitorObjectType":"APP",
"monitorObjectView":[{
"monitorObjectName":"0b5692738f53483da15a7d24483e747f",
"monitorObjectNameView":""
}]
},
"type":"INSTANCE",
"level":"MAJOR",
"actionEnabled":true,
"rules":[
[
{
"id":1,
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
{
"name":"cpu",
"value":"0"
}
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
],
[
{
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
]
],
"region":"bj",
"incidentActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"insufficientActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"resumeActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"srcName":"0b5692738f53483da15a7d24483e747f",
"srcType":"PROC",
"insufficientCycle":300,
"callbackUrl":"",
"callbackToken":"",
"repeatAlarmCycle":0,
"maxRepeatCount":0
}Request Response
{
"alarmDescription": "proc.cpu_usage average value > 90”,
"alarmName":"testAPPalarm",
"userId":"453bf9588c9e488f9ba2c98412******",
"appName":"test14",
"monitorObjectType":"APP",
"monitorObject":{
"id":1
"monitorObjectType":"APP",
"monitorObjectView":[{
"monitorObjectName":"0b5692738f53483da15a7d24483e747f",
"monitorObjectNameView":""
}]
},
"type":"INSTANCE",
"level":"MAJOR",
"actionEnabled":true,
"rules":[
[
{
"id":1,
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
{
"name":"cpu",
"value":"0"
}
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
],
[
{
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
]
],
"region":"bj",
"incidentActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"insufficientActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"resumeActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"srcName":"0b5692738f53483da15a7d24483e747f",
"srcType":"PROC",
"insufficientCycle":300,
"callbackUrl":"",
"callbackToken":"",
"repeatAlarmCycle":0,
"maxRepeatCount":0
}Alarm Strategy Update API
Request structure
Method:PUT
URI: /csm/api/v1/userId/{userId}/application/alarm/config/update
RequestBody
Same as the RequestBody for creating an Alarm Strategy
Request example
PUT /csm/api/v1/userId/453bf9588c9e488f9ba2c984129090dc/application/alarm/config/update
Host: bcm.bj.baidubce.com:80
{
"alarmDescription": "proc.cpu_usage average value > 90”,
"alarmName":"testAPPalarm",
"userId":"453bf9588c9e488f9ba2c984129090dc",
"appName":"test14",
"monitorObjectType":"APP",
"monitorObject":{
"id":1
"monitorObjectType":"APP",
"monitorObjectView":[{
"monitorObjectName":"0b5692738f53483da15a7d24483e747f",
"monitorObjectNameView":""
}]
},
"type":"INSTANCE",
"level":"MAJOR",
"actionEnabled":true,
"rules":[
[
{
"id":1,
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
{
"name":"method",
"value":"POST"
},
{
"name":"path",
"value":"/api/search"
}
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
],
[
{
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
]
],
"region":"bj",
"incidentActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"insufficientActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"resumeActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"srcName":"0b5692738f53483da15a7d24483e747f",
"srcType":"PROC",
"insufficientCycle":300,
"callbackUrl":"",
"callbackToken":"",
"repeatAlarmCycle":0,
"maxRepeatCount":0
}Request Response
{
"alarmDescription": "proc.cpu_usage average value > 90”,
"alarmName":"testAPPalarm",
"userId":"453bf9588c9e488f9ba2c984129090dc",
"appName":"test14",
"monitorObjectType":"APP",
"monitorObject":{
"id":1
"monitorObjectType":"APP",
"monitorObjectView":[{
"monitorObjectName":"0b5692738f53483da15a7d24483e747f",
"monitorObjectNameView":""
}]
},
"type":"INSTANCE",
"level":"MAJOR",
"actionEnabled":true,
"rules":[
[
{
"id":1,
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
{
"name":"method",
"value":"POST"
},
{
"name":"path",
"value":"/api/search"
}
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
],
[
{
"metric":"proc.cpu_usage",
"metricAlia": "CPU Utilization",
"metricDimensions":[
],
"cycle":60,
"statistics":"AVG",
"threshold":"10",
"comparisonOperator":"GT",
"count":3,
"function":"THRESHOLD",
"sequence":1,
}
]
],
"region":"bj",
"incidentActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"insufficientActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"resumeActions":[
"27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
],
"srcName":"0b5692738f53483da15a7d24483e747f",
"srcType":"PROC",
"insufficientCycle":300,
"callbackUrl":"",
"callbackToken":"",
"repeatAlarmCycle":0,
"maxRepeatCount":0
}Alarm Strategy List API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/alarm/config/list
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
appName |
String | Application Name, if not passed, all Application Monitors are implied | No |
alarmName |
String | Strategy Name, used for search filtering | No |
actionEnabled |
bool | Whether to disable Notification, used for filtering | No |
srcType |
String | Monitoring Method: Process (PROC) / Port (PORT) / Log (LOG) / Script (SCR), if not provided, indicates all monitoring methods |
No |
| taskName | String | Task Identifier Name (UUID string), used for filtering | No |
pageNo |
String | Pagination page number | Yes |
pageSize |
String | Page size, defaulting to 10 | No |
Request example
GET /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/alarm/config/list?pageNo=1&srcType=PORT&actionEnabled=true&pageSize=2
Host: bcm.bj.baidubce.com:80Request Response
{
"orderBy": "",
"order": "",
"pageNo": 1,
"pageSize": 2,
"totalCount": 7,
"result": [
{
"alarmDescription": "",
"alarmName": "config-yyy",
"userId": "453bf9588c9e488f9ba2c98412******",
"appName": "yyy-test",
"region": "bj",
"monitorObjectType": "APP",
"monitorObject": {
"id": null,
"monitorObjectView": [
{
"monitorObjectName": "yyy-test.453bf9588c9e488f9ba2c98412******",
"monitorObjectNameView": "",
"metricDimensionView": ""
}
],
"monitorObjectType": "APP",
"typeName": "kInstance"
},
"srcName": "f29d726bc73b4c5bbc813e40a7d3b38c",
"srcType": "PORT",
"type": "INSTANCE",
"level": "MAJOR",
"actionEnabled": true,
"policyEnabled": true,
"rules": [
[
{
"metric": "port.err_code",
"metricAlias": "Error Code",
"cycle": 60,
"statistics": "average",
"threshold": 3.0,
"comparisonOperator": ">",
"count": 1,
"function": "THRESHOLD",
"sequence": 0,
"metricDimensions": [],
"formulaV2Alias": "Error Code 1-Minute Average>3.00",
"metricTags": null
}
]
],
"incidentActions": [
"YYY-test"
],
"resumeActions": [],
"insufficientActions": [],
"insufficientCycle": 0,
"repeatAlarmCycle": 0,
"maxRepeatCount": 0,
"tag": ""
},
{
"alarmDescription": "",
"alarmName": "yyy-and-test",
"userId": "453bf9588c9e488f9ba2c98412******",
"appName": "yyy-test",
"region": "bj",
"monitorObjectType": "APP",
"monitorObject": {
"id": null,
"monitorObjectView": [
{
"monitorObjectName": "yyy-test.453bf9588c9e488f9ba2c98412******",
"monitorObjectNameView": "",
"metricDimensionView": ""
}
],
"monitorObjectType": "APP",
"typeName": "kInstance"
},
"srcName": "f29d726bc73b4c5bbc813e40a7d3b38c",
"srcType": "PORT",
"type": "INSTANCE",
"level": "NOTICE",
"actionEnabled": true,
"policyEnabled": true,
"rules": [
[
{
"metric": "port.err_code",
"metricAlias": "Error Code",
"cycle": 60,
"statistics": "average",
"threshold": 0.0,
"comparisonOperator": ">",
"count": 1,
"function": "THRESHOLD",
"sequence": 0,
"metricDimensions": [],
"formulaV2Alias": "Error Code 1-Minute Average>0.00",
"metricTags": null
},
{
"metric": "port.err_code",
"metricAlias": "Error Code",
"cycle": 60,
"statistics": "average",
"threshold": 2.0,
"comparisonOperator": "<",
"count": 1,
"function": "THRESHOLD",
"sequence": 0,
"metricDimensions": [],
"formulaV2Alias": "Error Code 1-Minute Average<2.00",
"metricTags": null
}
],
[
{
"metric": "port.res_time",
"metricAlias": "Response Time”,
"cycle": 60,
"statistics": "average",
"threshold": 5.0,
"comparisonOperator": ">",
"count": 1,
"function": "THRESHOLD",
"sequence": 1,
"metricDimensions": [],
"formulaV2Alias": "Response Time 1-Minute Average>5.00ms",
"metricTags": null
}
]
],
"incidentActions": [
"YYY-test"
],
"resumeActions": [],
"insufficientActions": [],
"insufficientCycle": 0,
"repeatAlarmCycle": 0,
"maxRepeatCount": 0,
"tag": ""
}
]
}Alarm Strategy Delete API
Request structure
Method:DELETE
URI: /csm/api/v1/userId/{userId}/application/alarm/config
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
appName |
String | Application Name | Yes |
alarmName |
String | Strategy Identifier Name | Yes |
Request example
DELETE /csm/api/v1/userId/453bf9588c9e488f9ba2c984129090dc/application/alarm/config
Host: bcm.bj.baidubce.com:80
{
"appName":"test14",
"alarmName":"proc666"
}Request Response
HTTP 200Alarm Strategy Details API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/alarm/{alarmName}/config
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| alarmName | String | Alarm Strategy Name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
appName |
String | Application Name | Yes |
Request example
GET /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/alarm/inst-test/config?appName=test_ymd_app_0918
Host: bcm.bj.baidubce.com:80Request Response
{
// Alarm Description
"alarmDescription": "",
// Alarm Strategy Name
"alarmName": "inst-test",
// User ID
"userId": "453bf9588c9e488f9ba2c98412******",
// Application Name
"appName": "test_ymd_app_0918",
"region": "bj",
"monitorObjectType": "APP",
"monitorObject": {
"id": null,
"monitorObjectView": [
{
"monitorObjectName": "test_ymd_app_0918.453bf9588c9e488f9ba2c98412******",
"monitorObjectNameView": "",
"metricDimensionView": ""
}
],
"monitorObjectType": "APP",
"typeName": "kInstance"
},
"srcName": "46e78b2831394f738429f88265c5b25f",
// Monitoring Method, enumerated values: PROC: Process LOG: Log PORT: Port SCR: Script
"srcType": "LOG",
// Monitor Object Type, enumerated values: INSTANCE: Instance SERVICE: Application
"type": "INSTANCE",
// Alarm Level
"level": "MAJOR",
// Whether Notification Template is Enabled
"actionEnabled": true,
// Whether the Alarm Strategy is enabled
"policyEnabled": true,
// Alarm Rules
"rules": [
[
{
"metric": "log.test_name",
"metricAlias": "test_name",
"cycle": 60,
"statistics": "average",
"threshold": 0.0,
"comparisonOperator": ">",
"count": 1,
"function": "THRESHOLD",
"sequence": 0,
"metricDimensions": [],
"formulaV2Alias": "test_name1-minute average >0.00",
"metricTags": null
}
]
],
// Abnormal Alarm Action
"incidentActions": [
"816a2a13-a817-4e43-bb7a-9a7922c092a5"
],
// Alarm Disable Alarm Action
"resumeActions": [],
// Insufficient Data Alarm Action
"insufficientActions": [],
// Insufficient Data Alarm Trigger Period
"insufficientCycle": 0,
// Alarm Repetition Interval
"repeatAlarmCycle": 0,
// Maximum Alarm Repetition Count
"maxRepeatCount": 0,
"tag": ""
}
}Alarm Metric List API
Request structure
Method:GET
URI: /csm/api/v1/userId/{userId}/application/{appName}/{taskName}/alarm/metrics
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
| appName | String | Application Name | Yes |
| taskName | String | Task name | Yes |
Query
| Name | Types | Description | Required or not |
|---|---|---|---|
| searchName | String | Metric name | No |
Request example
GET /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/test_ymd_app_0918/46e78b2831394f738429f88265******/alarm/metrics?searchName=test_namerics
Host: bcm.bj.baidubce.com:80Request Response
[
{
"id": 706,
"taskId": 3865, //Monitor Task ID
"metricName": "log.test_name", //Monitor Item Name
"metricAlias": "test_name", //Metric Alias
"metricUnit": "", //Metric unit
"valueFieldType": 1, //Value field: 0, log line count; 1. Single field; 2. Multiple fields
"valueFieldName": "", //Field name for value extraction in logs
"valueMatchRule”: null, //Filter Criteria
// Aggregated Data Dimension
"aggrTags": [
{
"range": "App",
"tags": ""
}
],
"saveInstanceData": 1. //Whether to save single-instance data
}
]Log Extraction API
Request structure
Method:POST
URI: /csm/api/v1/userId/{userId}/application/logextract
URL parameter
| Name | Types | Description | Required or not |
|---|---|---|---|
| userId | String | User ID | Yes |
RequestBody
| Name | Types | Description | Required or not |
|---|---|---|---|
| extractRule | String | Extraction rules | Yes |
| logExample | String | Log sample; note that multi-line logs should use \n for line breaks | Yes |
Request example
POST /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/logextract
Host: bcm.bj.baidubce.com:80
{
"extractRule": "800] \"(?<method>(GET|POST|PUT|DELETE)) .*/v1/dashboard/metric/(?<widget>(cycle|trend|report|billboard|gaugechart)) HTTP/1.1\".* (?<resTime>[0-9]+)ms",
"logExample": "10.157.16.207 - - [09/Apr/2020:20:45:33 +0800] \"POST /v1/dashboard/metric/gaugechart HTTP/1.1\" 200 117 109ms\n10.157.16.207 - - [09/Apr/2020:20:45:33 +0800] \"GET /v1/dashboard/metric/report HTTP/1.1\" 200 117 19ms"
}Request Response
[
{
"extractFieldName": "resTime",
"extractFieldValue": "19、109",
"metricEnable": 1
},
{
"extractFieldName": "widget",
"extractFieldValue": "gaugechart、report",
"metricEnable": 0
},
{
"extractFieldName": "method",
"extractFieldValue": "POST、GET",
"metricEnable": 0
}
]