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
1{
2 "type": "BCC",
3 "name": "test12",
4 "alias": "testAlias",
5 "description": "fafda",
6 "userId":"123456"
7}
Request Response
1{
2 "id": 1,
3 "name": "test",
4 "alias": "testAlias",
5 "type": "BCC",
6 "userId": "user1",
7 "description": "test"
8}
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
1{
2 "content":[
3 {
4 "id":1,
5 "name":"test",
6 "alias":"testAlias",
7 "type":"BCC",
8 "userId":"user1",
9 "description":"test"
10 }
11 ],
12 "totalElements":1,
13 "totalPages":1,
14 "size":10
15}
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
1PUT /csm/api/v1/userId/user1/application
2Host: bcm.bj.baidubce.com:80
3{
4 "id": 1,
5 "name": "test",
6 "alias": "testAlias3",
7 "type": "BCC",
8 "userId": "user1",
9 "description": "test"
10}
Response example
1{
2 "id": 1,
3 "name": "test",
4 "alias": "testAlias3",
5 "type": "BCC",
6 "userId": "user1",
7 "description": "test"
8}
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
1DELETE /csm/api/v1/userId/user1/application
2Host: bcm.bj.baidubce.com:80
3{
4 "name": "test"
5}
Response example
1HTTP 200
Application 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
1POST /csm/api/v1/userId/user1/instances/all
2Host: bcm.bj.baidubce.com:80
3{
4 "pageSize": 50,
5 "pageNo": 1,
6 "searchName": "name",
7 "searchValue": "instance-0eseehvy",
8 "region": "bj",
9 "appName": "test"
10}
Response example
1{
2 "content":[
3 {
4 "id":"387838",
5 "instanceId":"i-DvbyV9Lw",
6 "instanceUuid":"63deee8a-5ddb-4944-80fa-faa144825a65",
7 "name":"instance-0eseehvy",
8 "internalIp":"192.168.16.227",
9 "floatingIp":"100.88.66.222",
10 "publicIp":null,
11 "hasBinded":false
12 },
13 {
14 "id":"1258",
15 "instanceId":"i-aztzAEUk",
16 "instanceUuid":"50fb04a1-7adf-4769-b957-bf40b40d6b02",
17 "name":"instance-3k4ol2fr",
18 "internalIp":"192.168.16.39",
19 "floatingIp":"100.88.66.130",
20 "publicIp":null,
21 "hasBinded":false
22 },
23 {
24 "id":"385510",
25 "instanceId":"i-s6r0Y8xM",
26 "instanceUuid":"125b9e28-ecc4-4ec7-b584-6d65c743c153",
27 "name":"instance-u3ahll4c-1",
28 "internalIp":"192.168.16.225",
29 "floatingIp":"100.88.67.8",
30 "publicIp":null,
31 "hasBinded":false
32 },
33 {
34 "id":"385511",
35 "instanceId":"i-iTPduQhx",
36 "instanceUuid":"e1f0d8bb-845d-44ab-bc7c-08a8efccb8a0",
37 "name":"instance-u3ahll4c-2",
38 "internalIp":"192.168.16.226",
39 "floatingIp":"100.88.67.80",
40 "publicIp":null,
41 "hasBinded":false
42 }
43 ],
44 "query":null,
45 "fields":[
46
47 ],
48 "orderBy":[
49
50 ],
51 "pageNumber":1,
52 "pageSize":50,
53 "pageElements":4,
54 "last":true,
55 "first":true,
56 "totalPages":1,
57 "totalElements":4
58}
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
1POST /csm/api/v1/userId/123456/application/test14/instance/bind
2Host: bcm.bj.baidubce.com:80
3{
4 "appName": "test",
5 "userId": "453bf9588c9e488f9ba2c9841290****",
6 "hostList": [
7 {
8 "instanceId": "2096290b-5984-4c67-8ccc-864ca5f5****",
9 "region": "bj"
10 },
11 {
12 "instanceId": "7d4e09af-d01b-4492-88e9-c27d9096****",
13 "region": "bj"
14 }
15 ]
16}
Request example
1true
Created 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
1GET /csm/api/v1/userId/user1/application/test/instance/list?region=bj
2Host: bcm.bj.baidubce.com:80
Response example
1[
2 {
3 "id": 1,
4 "name": "0.test",
5 "offset": 0,
6 "instanceId": "instance1",
7 "region": "bj",
8 "userId": "user1",
9 "appName": "test"
10 },
11 {
12 "id": 2,
13 "name": "1.test",
14 "offset": 1,
15 "instanceId": "instance2",
16 "region": "bj",
17 "userId": "user1",
18 "appName": "test"
19 }
20]
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
1DELETE /csm/api/v1/userId/user1/application/instance
2Host: bcm.bj.baidubce.com:80
3
4
5{
6 "id": 1,
7 "appName": "test"
8}
Response example
1HTTP 200
Monitor 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
1POST /csm/api/v1/userId/123456/application/test14/task/create
2Host: bcm.bj.baidubce.com:80
3
4{
5 "aliasName": "agent_test_task",
6 "type": 0,
7 "cycle":60,
8 "target":"/bcm-agent",
9 "description":"agent task"
10}
Request response 1
1{
2 "id": 1,
3 "name": "0ebea6b1efb74867b7bbaa17caa95e7a", // Monitor Task Unique Identifier
4 "aliasName": "test_task",
5 "appName": "test14",
6 "userId": "123456",
7 "cycle": 60,
8 "target": "/bcm-agent",
9 "type": 0,
10 "description": "test task"
11}
Request example 2
1POST /csm/api/v1/userId/123456/application/test14/task/create
2Host: bcm.bj.baidubce.com:80
3
4{
5 "aliasName": "log_test_task20",
6 "type": 2,
7 "cycle": 60,
8 "target": "/tmp/test.log",
9 "description": "log task",
10 "logExample": "10.157.16.207 - - [09/Apr/2020:20:45:33 +0800] \"POST /v1/dashboard/metric/gaugechart HTTP/1.1\" 200 117 47ms",
11 "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",
12 "rate": 5,
13 "extractResult": [
14 {
15 "extractFieldName": "widget",
16 "extractFieldValue": "gaugechart",
17 "dimensionMapTable": "path"
18 }
19 ],
20 "metrics": [
21 {
22 "metricName": "con_tsdb_time",
23 "metricAlias": "Response Time”,
24 "valueFieldName": "resTime",
25 "aggrTags": [
26 {
27 "range": "All",
28 "tags": "method,widget"
29 },
30 {
31 "range": "All",
32 "tags": "method"
33 }
34 ]
35 }
36 ]
37}
Request response 2
1{
2 "id": 1,
3 "name": "79c35af26c4346ab844bcbcdde2875c3",
4 "aliasName": "log_test_task20",
5 "type": 2,
6 "cycle": 60,
7 "target": "/tmp/test.log",
8 "description": "log task",
9 "logExample": "10.157.16.207 - - [09/Apr/2020:20:45:33 +0800] \"POST /v1/dashboard/metric/gaugechart HTTP/1.1\" 200 117 47ms",
10 "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",
11 "rate": 5,
12 "extractResult": [
13 {
14 "extractFieldName": "widget20",
15 "extractFieldValue": "gaugechart20",
16 "dimensionMapTable": "path"
17 }
18 ],
19 "metrics": [
20 {
21 "metricName": "con_tsdb_time20",
22 "metricAlias": "Response Time”,
23 "valueFieldName": "resTime",
24 "aggrTags": [
25 {
26 "range": "All",
27 "tags": "method,widget"
28 },
29 {
30 "range": "All",
31 "tags": "method"
32 }
33 ]
34 }
35 ]
36}
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
1GET /csm/api/v1/userId/123456/application/test14/task/2096eb64edaf484cb84eff5ccb33bfd5
2Host: bcm.bj.baidubce.com:80
Request response 1
1{
2 "id": 2,
3 "name": "2096eb64edaf484cb84eff5ccb33bfd5",
4 "aliasName": "2489qhwif384189",
5 "appName": "test14",
6 "userId": "123456",
7 "cycle": 60,
8 "target": "/python",
9 "type": 0,
10 "description": "python task"
11}
Request example 2
1GET /csm/api/v1/userId/123456/application/test14/task/79c35af26c4346ab844bcbcdde2875c3
2Host: bcm.bj.baidubce.com:80
Request response 2
1{
2 "id": 11,
3 "name": "79c35af26c4346ab844bcbcdde2875c3",
4 "aliasName": "log_test_task2",
5 "appName": "test14",
6 "userId": "123456",
7 "cycle": 60,
8 "target": "/home/work/bcm/csm.log",
9 "type": 2,
10 "description": "log task2",
11 "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:",
12 "matchRule": "(time)(ms)",
13 "rate": 5,
14 "extractResult": [
15 {
16 "id": 7,
17 "taskId": 11,
18 "extractFieldName": "time",
19 "extractFieldValue": "50",
20 "dimensionMapTable": null
21 }
22 ],
23 "metrics": [
24 {
25 "id": 2,
26 "taskId": 11,
27 "metricName": "responseTime",
28 "metricAlias": "Response Time”,
29 "metricUnit": "ms",
30 "valueFieldType": 1,
31 "valueFieldName": "responseTime",
32 "valueMatchRule": null,
33 "aggrInstanceRange": "ALL",
34 "aggrTags": "",
35 "saveInstanceData": 0
36 }
37 ]
38}
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
1GET /csm/api/v1/userId/123456/application/test14/task/list?type=1
2Host: bcm.bj.baidubce.com:80
Request Response
1[
2 {
3 "id": 4,
4 "name": "171f6e3052fb414098581f7886d66233",
5 "aliasName": "port_test_task",
6 "appName": "test14",
7 "userId": "123456",
8 "cycle": 60,
9 "target": "8855",
10 "type": 1,
11 "description": "port task"
12 }
13]
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
1PUT /csm/api/v1/userId/123456/application/test14/task/79c35af26c4346ab844bcbcdde2875c3
2Host: bcm.bj.baidubce.com:80
3{
4 "id": 11,
5 "name": "79c35af26c4346ab844bcbcdde2875c3",
6 "aliasName": "log_test_task2",
7 "appName": "test14",
8 "userId": "123456",
9 "cycle": 60,
10 "target": "/home/work/bcm/csm.log",
11 "type": 2,
12 "description": "log task update2",
13 "logExample": "11-12T16:27:08.149+08:00 DEBUG 86884 [csm-saver-1357862653] --- c.b.b.b.s.m.i.TsdbDataPushServiceImpl",
14 "matchRule": "*",
15 "rate": 5,
16 "extractResult": [
17 {
18 "extractFieldName": "responseTime2",
19 "extractFieldValue": "responseTime2",
20 "dimensionMapTable": "123"
21 }
22 ],
23 "metrics": [
24 {
25 "metricName": "responseTime2",
26 "metricAlias": "Response Time-update2",
27 "metricUnit": "ms",
28 "valueFieldType": 1,
29 "valueFieldName": "responseTime2",
30 "valueMatchRule": null,
31 "aggrInstanceRange": "ALL",
32 "aggrTags": "",
33 "saveInstanceData": 0
34 }
35 ]
36}
Request Response
1{
2 "id": 11,
3 "name": "79c35af26c4346ab844bcbcdde2875c3",
4 "aliasName": "log_test_task2",
5 "appName": "test14",
6 "userId": "123456",
7 "cycle": 60,
8 "target": "/home/work/bcm/csm.log",
9 "type": 2,
10 "description": "log task update2",
11 "logExample": "11-12T16:27:08.149+08:00 DEBUG 86884 [csm-saver-1357862653] --- c.b.b.b.s.m.i.TsdbDataPushServiceImpl",
12 "matchRule": "*",
13 "rate": 5,
14 "extractResult": [
15 {
16 "extractFieldName": "responseTime2",
17 "extractFieldValue": "responseTime2",
18 "dimensionMapTable": "123"
19 }
20 ],
21 "metrics": [
22 {
23 "metricName": "responseTime2",
24 "metricAlias": "Response Time-update2",
25 "metricUnit": "ms",
26 "valueFieldType": 1,
27 "valueFieldName": "responseTime2",
28 "valueMatchRule": null,
29 "aggrInstanceRange": "ALL",
30 "aggrTags": "",
31 "saveInstanceData": 0
32 }
33 ]
34}
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
1DELETE /csm/api/v1/userId/123456/application/task/delete
2Host: bcm.bj.baidubce.com:80
3
4
5{
6 "name":"79c35af26c4346ab844bcbcdde2875c3",
7 "appName":"test14"
8}
Request Response
1HTTP 200
Dimension 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
1POST /csm/api/v1/userId/123456/application/dimensionMap/create
2Host: bcm.bj.baidubce.com:80
3
4
5
6{
7 "userId": "123456",
8 "appName": "test14",
9 "mapContentJson": "chinanet=>cn\nchinacom=>cc",
10 "tableName": "isp"
11}
Request Response
1{
2 "userId": "123456",
3 "appName": "test14",
4 "mapContentJson": "chinanet=>cn\nchinacom=>cc",
5 "tableName": "isp"
6}
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
1GET /csm/api/v1/userId/123456/application/test14/dimensionMap/list?searchName=is
2Host: bcm.bj.baidubce.com:80
Request Response
1[
2 {
3 "userId": "123456",
4 "appName": "test14",
5 "mapContentJson": "chinanet=>cn\nchinacom=>cc",
6 "tableName": "isp"
7 }
8]
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
1DELETE /csm/api/v1/userId/123456/application/test14/dimensionMap/isp
Request Response
1HTTP 200
Dimension 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
1PUT /csm/api/v1/userId/123456/application/dimensionMap/update
2Host: bcm.bj.baidubce.com:80
3
4
5{
6 "userId": "123456",
7 "appName": "test14",
8 "mapContentJson": "chinanet=>cn\nchinacom=>cc",
9 "tableName": "isp"
10}
Request Response
1HTTP 200
Monitoring 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
1GET /csm/api/v1/userId/a0d04d7c202140cb80155ff7b6******/application/test14/task/79c35af26c4346ab844bcbcdde******/metricMeta?instances=0.test14,1.test14&metricName=log.responseTime&dimensionKeys=method
2Host: bcm.bj.baidubce.com:80
Request Response
1{
2 "method":[
3 "GET",
4 "POST",
5 "PUT"
6 ]
7}
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
1GET 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
2Host: bcm.bj.baidubce.com:80
Request Response
1[
2 {
3 "namespace": "0.zmq-log-1115",
4 "dimensions": [],
5 "dataPoints": [
6 {
7 "timestamp": "2023-12-05T09:54:15Z",
8 "average": 66.0
9 },
10 {
11 "timestamp": "2023-12-05T09:58:15Z",
12 "average": 66.0
13 },
14 {
15 "timestamp": "2023-12-05T10:02:15Z",
16 "average": 66.0
17 }
18 ]
19 },
20 {
21 "namespace": "1.zmq-log-1115",
22 "dimensions": [],
23 "dataPoints": [
24 {
25 "timestamp": "2023-12-05T09:54:15Z"
26 },
27 {
28 "timestamp": "2023-12-05T09:58:15Z"
29 },
30 {
31 "timestamp": "2023-12-05T10:02:15Z"
32 }
33 ]
34 }
35]
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
1POST /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/alarm/config/create
2Host: bcm.bj.baidubce.com:80
3
4{
5 "alarmDescription": "proc.cpu_usage average value > 90”,
6 "alarmName":"testAPPalarm",
7 "userId":"453bf9588c9e488f9ba2c98412******",
8 "appName":"test14",
9 "monitorObjectType":"APP",
10 "monitorObject":{
11 "id":1
12 "monitorObjectType":"APP",
13 "monitorObjectView":[{
14 "monitorObjectName":"0b5692738f53483da15a7d24483e747f",
15 "monitorObjectNameView":""
16 }]
17 },
18 "type":"INSTANCE",
19 "level":"MAJOR",
20 "actionEnabled":true,
21 "rules":[
22 [
23 {
24 "id":1,
25 "metric":"proc.cpu_usage",
26 "metricAlia": "CPU Utilization",
27 "metricDimensions":[
28 {
29 "name":"cpu",
30 "value":"0"
31 }
32 ],
33 "cycle":60,
34 "statistics":"AVG",
35 "threshold":"10",
36 "comparisonOperator":"GT",
37 "count":3,
38 "function":"THRESHOLD",
39 "sequence":1,
40 }
41 ],
42 [
43 {
44 "metric":"proc.cpu_usage",
45 "metricAlia": "CPU Utilization",
46 "metricDimensions":[
47
48 ],
49 "cycle":60,
50 "statistics":"AVG",
51 "threshold":"10",
52 "comparisonOperator":"GT",
53 "count":3,
54 "function":"THRESHOLD",
55 "sequence":1,
56 }
57 ]
58 ],
59 "region":"bj",
60 "incidentActions":[
61 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
62 ],
63 "insufficientActions":[
64 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
65 ],
66 "resumeActions":[
67 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
68 ],
69 "srcName":"0b5692738f53483da15a7d24483e747f",
70 "srcType":"PROC",
71 "insufficientCycle":300,
72 "callbackUrl":"",
73 "callbackToken":"",
74 "repeatAlarmCycle":0,
75 "maxRepeatCount":0
76}
Request Response
1{
2 "alarmDescription": "proc.cpu_usage average value > 90”,
3 "alarmName":"testAPPalarm",
4 "userId":"453bf9588c9e488f9ba2c98412******",
5 "appName":"test14",
6 "monitorObjectType":"APP",
7 "monitorObject":{
8 "id":1
9 "monitorObjectType":"APP",
10 "monitorObjectView":[{
11 "monitorObjectName":"0b5692738f53483da15a7d24483e747f",
12 "monitorObjectNameView":""
13 }]
14 },
15 "type":"INSTANCE",
16 "level":"MAJOR",
17 "actionEnabled":true,
18 "rules":[
19 [
20 {
21 "id":1,
22 "metric":"proc.cpu_usage",
23 "metricAlia": "CPU Utilization",
24 "metricDimensions":[
25 {
26 "name":"cpu",
27 "value":"0"
28 }
29 ],
30 "cycle":60,
31 "statistics":"AVG",
32 "threshold":"10",
33 "comparisonOperator":"GT",
34 "count":3,
35 "function":"THRESHOLD",
36 "sequence":1,
37 }
38 ],
39 [
40 {
41 "metric":"proc.cpu_usage",
42 "metricAlia": "CPU Utilization",
43 "metricDimensions":[
44
45 ],
46 "cycle":60,
47 "statistics":"AVG",
48 "threshold":"10",
49 "comparisonOperator":"GT",
50 "count":3,
51 "function":"THRESHOLD",
52 "sequence":1,
53 }
54 ]
55 ],
56 "region":"bj",
57 "incidentActions":[
58 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
59 ],
60 "insufficientActions":[
61 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
62 ],
63 "resumeActions":[
64 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
65 ],
66 "srcName":"0b5692738f53483da15a7d24483e747f",
67 "srcType":"PROC",
68 "insufficientCycle":300,
69 "callbackUrl":"",
70 "callbackToken":"",
71 "repeatAlarmCycle":0,
72 "maxRepeatCount":0
73}
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
1PUT /csm/api/v1/userId/453bf9588c9e488f9ba2c984129090dc/application/alarm/config/update
2Host: bcm.bj.baidubce.com:80
3
4
5{
6 "alarmDescription": "proc.cpu_usage average value > 90”,
7 "alarmName":"testAPPalarm",
8 "userId":"453bf9588c9e488f9ba2c984129090dc",
9 "appName":"test14",
10 "monitorObjectType":"APP",
11 "monitorObject":{
12 "id":1
13 "monitorObjectType":"APP",
14 "monitorObjectView":[{
15 "monitorObjectName":"0b5692738f53483da15a7d24483e747f",
16 "monitorObjectNameView":""
17 }]
18 },
19 "type":"INSTANCE",
20 "level":"MAJOR",
21 "actionEnabled":true,
22 "rules":[
23 [
24 {
25 "id":1,
26 "metric":"proc.cpu_usage",
27 "metricAlia": "CPU Utilization",
28 "metricDimensions":[
29 {
30 "name":"method",
31 "value":"POST"
32 },
33 {
34 "name":"path",
35 "value":"/api/search"
36 }
37 ],
38 "cycle":60,
39 "statistics":"AVG",
40 "threshold":"10",
41 "comparisonOperator":"GT",
42 "count":3,
43 "function":"THRESHOLD",
44 "sequence":1,
45 }
46 ],
47 [
48 {
49 "metric":"proc.cpu_usage",
50 "metricAlia": "CPU Utilization",
51 "metricDimensions":[
52
53 ],
54 "cycle":60,
55 "statistics":"AVG",
56 "threshold":"10",
57 "comparisonOperator":"GT",
58 "count":3,
59 "function":"THRESHOLD",
60 "sequence":1,
61 }
62 ]
63 ],
64 "region":"bj",
65 "incidentActions":[
66 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
67 ],
68 "insufficientActions":[
69 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
70 ],
71 "resumeActions":[
72 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
73 ],
74 "srcName":"0b5692738f53483da15a7d24483e747f",
75 "srcType":"PROC",
76 "insufficientCycle":300,
77 "callbackUrl":"",
78 "callbackToken":"",
79 "repeatAlarmCycle":0,
80 "maxRepeatCount":0
81}
Request Response
1{
2 "alarmDescription": "proc.cpu_usage average value > 90”,
3 "alarmName":"testAPPalarm",
4 "userId":"453bf9588c9e488f9ba2c984129090dc",
5 "appName":"test14",
6 "monitorObjectType":"APP",
7 "monitorObject":{
8 "id":1
9 "monitorObjectType":"APP",
10 "monitorObjectView":[{
11 "monitorObjectName":"0b5692738f53483da15a7d24483e747f",
12 "monitorObjectNameView":""
13 }]
14 },
15 "type":"INSTANCE",
16 "level":"MAJOR",
17 "actionEnabled":true,
18 "rules":[
19 [
20 {
21 "id":1,
22 "metric":"proc.cpu_usage",
23 "metricAlia": "CPU Utilization",
24 "metricDimensions":[
25 {
26 "name":"method",
27 "value":"POST"
28 },
29 {
30 "name":"path",
31 "value":"/api/search"
32 }
33 ],
34 "cycle":60,
35 "statistics":"AVG",
36 "threshold":"10",
37 "comparisonOperator":"GT",
38 "count":3,
39 "function":"THRESHOLD",
40 "sequence":1,
41 }
42 ],
43 [
44 {
45 "metric":"proc.cpu_usage",
46 "metricAlia": "CPU Utilization",
47 "metricDimensions":[
48
49 ],
50 "cycle":60,
51 "statistics":"AVG",
52 "threshold":"10",
53 "comparisonOperator":"GT",
54 "count":3,
55 "function":"THRESHOLD",
56 "sequence":1,
57 }
58 ]
59 ],
60 "region":"bj",
61 "incidentActions":[
62 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
63 ],
64 "insufficientActions":[
65 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
66 ],
67 "resumeActions":[
68 "27a51ad0-db67-45bb-8b50-ce0c5ca5a5f9"
69 ],
70 "srcName":"0b5692738f53483da15a7d24483e747f",
71 "srcType":"PROC",
72 "insufficientCycle":300,
73 "callbackUrl":"",
74 "callbackToken":"",
75 "repeatAlarmCycle":0,
76 "maxRepeatCount":0
77}
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
1GET /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/alarm/config/list?pageNo=1&srcType=PORT&actionEnabled=true&pageSize=2
2Host: bcm.bj.baidubce.com:80
Request Response
1{
2 "orderBy": "",
3 "order": "",
4 "pageNo": 1,
5 "pageSize": 2,
6 "totalCount": 7,
7 "result": [
8 {
9 "alarmDescription": "",
10 "alarmName": "config-yyy",
11 "userId": "453bf9588c9e488f9ba2c98412******",
12 "appName": "yyy-test",
13 "region": "bj",
14 "monitorObjectType": "APP",
15 "monitorObject": {
16 "id": null,
17 "monitorObjectView": [
18 {
19 "monitorObjectName": "yyy-test.453bf9588c9e488f9ba2c98412******",
20 "monitorObjectNameView": "",
21 "metricDimensionView": ""
22 }
23 ],
24 "monitorObjectType": "APP",
25 "typeName": "kInstance"
26 },
27 "srcName": "f29d726bc73b4c5bbc813e40a7d3b38c",
28 "srcType": "PORT",
29 "type": "INSTANCE",
30 "level": "MAJOR",
31 "actionEnabled": true,
32 "policyEnabled": true,
33 "rules": [
34 [
35 {
36 "metric": "port.err_code",
37 "metricAlias": "Error Code",
38 "cycle": 60,
39 "statistics": "average",
40 "threshold": 3.0,
41 "comparisonOperator": ">",
42 "count": 1,
43 "function": "THRESHOLD",
44 "sequence": 0,
45 "metricDimensions": [],
46 "formulaV2Alias": "Error Code 1-Minute Average>3.00",
47 "metricTags": null
48 }
49 ]
50 ],
51 "incidentActions": [
52 "YYY-test"
53 ],
54 "resumeActions": [],
55 "insufficientActions": [],
56 "insufficientCycle": 0,
57 "repeatAlarmCycle": 0,
58 "maxRepeatCount": 0,
59 "tag": ""
60 },
61 {
62 "alarmDescription": "",
63 "alarmName": "yyy-and-test",
64 "userId": "453bf9588c9e488f9ba2c98412******",
65 "appName": "yyy-test",
66 "region": "bj",
67 "monitorObjectType": "APP",
68 "monitorObject": {
69 "id": null,
70 "monitorObjectView": [
71 {
72 "monitorObjectName": "yyy-test.453bf9588c9e488f9ba2c98412******",
73 "monitorObjectNameView": "",
74 "metricDimensionView": ""
75 }
76 ],
77 "monitorObjectType": "APP",
78 "typeName": "kInstance"
79 },
80 "srcName": "f29d726bc73b4c5bbc813e40a7d3b38c",
81 "srcType": "PORT",
82 "type": "INSTANCE",
83 "level": "NOTICE",
84 "actionEnabled": true,
85 "policyEnabled": true,
86 "rules": [
87 [
88 {
89 "metric": "port.err_code",
90 "metricAlias": "Error Code",
91 "cycle": 60,
92 "statistics": "average",
93 "threshold": 0.0,
94 "comparisonOperator": ">",
95 "count": 1,
96 "function": "THRESHOLD",
97 "sequence": 0,
98 "metricDimensions": [],
99 "formulaV2Alias": "Error Code 1-Minute Average>0.00",
100 "metricTags": null
101 },
102 {
103 "metric": "port.err_code",
104 "metricAlias": "Error Code",
105 "cycle": 60,
106 "statistics": "average",
107 "threshold": 2.0,
108 "comparisonOperator": "<",
109 "count": 1,
110 "function": "THRESHOLD",
111 "sequence": 0,
112 "metricDimensions": [],
113 "formulaV2Alias": "Error Code 1-Minute Average<2.00",
114 "metricTags": null
115 }
116 ],
117 [
118 {
119 "metric": "port.res_time",
120 "metricAlias": "Response Time”,
121 "cycle": 60,
122 "statistics": "average",
123 "threshold": 5.0,
124 "comparisonOperator": ">",
125 "count": 1,
126 "function": "THRESHOLD",
127 "sequence": 1,
128 "metricDimensions": [],
129 "formulaV2Alias": "Response Time 1-Minute Average>5.00ms",
130 "metricTags": null
131 }
132 ]
133 ],
134 "incidentActions": [
135 "YYY-test"
136 ],
137 "resumeActions": [],
138 "insufficientActions": [],
139 "insufficientCycle": 0,
140 "repeatAlarmCycle": 0,
141 "maxRepeatCount": 0,
142 "tag": ""
143 }
144 ]
145}
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
1DELETE /csm/api/v1/userId/453bf9588c9e488f9ba2c984129090dc/application/alarm/config
2Host: bcm.bj.baidubce.com:80
3
4{
5 "appName":"test14",
6 "alarmName":"proc666"
7}
Request Response
1HTTP 200
Alarm 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
1GET /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/alarm/inst-test/config?appName=test_ymd_app_0918
2Host: bcm.bj.baidubce.com:80
Request Response
1{
2 // Alarm Description
3 "alarmDescription": "",
4 // Alarm Strategy Name
5 "alarmName": "inst-test",
6 // User ID
7 "userId": "453bf9588c9e488f9ba2c98412******",
8 // Application Name
9 "appName": "test_ymd_app_0918",
10 "region": "bj",
11 "monitorObjectType": "APP",
12 "monitorObject": {
13 "id": null,
14 "monitorObjectView": [
15 {
16 "monitorObjectName": "test_ymd_app_0918.453bf9588c9e488f9ba2c98412******",
17 "monitorObjectNameView": "",
18 "metricDimensionView": ""
19 }
20 ],
21 "monitorObjectType": "APP",
22 "typeName": "kInstance"
23 },
24 "srcName": "46e78b2831394f738429f88265c5b25f",
25 // Monitoring Method, enumerated values: PROC: Process LOG: Log PORT: Port SCR: Script
26 "srcType": "LOG",
27 // Monitor Object Type, enumerated values: INSTANCE: Instance SERVICE: Application
28 "type": "INSTANCE",
29 // Alarm Level
30 "level": "MAJOR",
31 // Whether Notification Template is Enabled
32 "actionEnabled": true,
33 // Whether the Alarm Strategy is enabled
34 "policyEnabled": true,
35 // Alarm Rules
36 "rules": [
37 [
38 {
39 "metric": "log.test_name",
40 "metricAlias": "test_name",
41 "cycle": 60,
42 "statistics": "average",
43 "threshold": 0.0,
44 "comparisonOperator": ">",
45 "count": 1,
46 "function": "THRESHOLD",
47 "sequence": 0,
48 "metricDimensions": [],
49 "formulaV2Alias": "test_name1-minute average >0.00",
50 "metricTags": null
51 }
52 ]
53 ],
54 // Abnormal Alarm Action
55 "incidentActions": [
56 "816a2a13-a817-4e43-bb7a-9a7922c092a5"
57 ],
58 // Alarm Disable Alarm Action
59 "resumeActions": [],
60 // Insufficient Data Alarm Action
61 "insufficientActions": [],
62 // Insufficient Data Alarm Trigger Period
63 "insufficientCycle": 0,
64 // Alarm Repetition Interval
65 "repeatAlarmCycle": 0,
66 // Maximum Alarm Repetition Count
67 "maxRepeatCount": 0,
68 "tag": ""
69}
70}
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
1GET /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/test_ymd_app_0918/46e78b2831394f738429f88265******/alarm/metrics?searchName=test_namerics
2Host: bcm.bj.baidubce.com:80
Request Response
1[
2 {
3 "id": 706,
4 "taskId": 3865, //Monitor Task ID
5 "metricName": "log.test_name", //Monitor Item Name
6 "metricAlias": "test_name", //Metric Alias
7 "metricUnit": "", //Metric unit
8 "valueFieldType": 1, //Value field: 0, log line count; 1. Single field; 2. Multiple fields
9 "valueFieldName": "", //Field name for value extraction in logs
10 "valueMatchRule”: null, //Filter Criteria
11 // Aggregated Data Dimension
12 "aggrTags": [
13 {
14 "range": "App",
15 "tags": ""
16 }
17 ],
18 "saveInstanceData": 1. //Whether to save single-instance data
19 }
20]
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
1POST /csm/api/v1/userId/453bf9588c9e488f9ba2c98412******/application/logextract
2Host: bcm.bj.baidubce.com:80
3
4{
5 "extractRule": "800] \"(?<method>(GET|POST|PUT|DELETE)) .*/v1/dashboard/metric/(?<widget>(cycle|trend|report|billboard|gaugechart)) HTTP/1.1\".* (?<resTime>[0-9]+)ms",
6 "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"
7}
Request Response
1[
2 {
3 "extractFieldName": "resTime",
4 "extractFieldValue": "19、109",
5 "metricEnable": 1
6 },
7 {
8 "extractFieldName": "widget",
9 "extractFieldValue": "gaugechart、report",
10 "metricEnable": 0
11 },
12 {
13 "extractFieldName": "method",
14 "extractFieldValue": "POST、GET",
15 "metricEnable": 0
16 }
17]
