百度智能云

All Product Document

          Cloud Monitor

          Custom Monitoring-Push Data Interface

          Interface Description

          It pushes the data to BCM for monitoring. When you use the custom monitoring function, you can push the time series data to BCM for real-time monitoring through this API.

          Request Structure

          • Request method:POST
          • URL:/csm/api/v1/userId/{userId}/custom/data
          • For URL parameters and request body, see the following parameter list and request example.

          List of parameters:

          URL Parameter

          Name Type Description Required?
          userId String The tenant ID Yes

          RequestBody Parameters

          Name Type Description Required?
          namespace String Scope Yes
          metricName String Name of monitoring items Yes
          dimensions List<Dimension> Dimensions Yes
          value double Value of monitoring item Yes
          timestamp String Time Yes

          Dimension Name

          Name Type Description Required?
          name String Dimension name Yes
          value String Dimension value Yes

          Response Parameter

          Name Type Description
          requestId String Request identification
          code String Return code
          message String Return information

          Request Example

          POST  /csm/api/v1/userId/user1/custom/data  HTTP/1.1  
          Host:bcm.bj.baidubce.com:80  
          
          {
              "namespace":"namespace1"
              "metricName": "pv",
              "dimensions": [
                  {
                      "name": "dimension1",
                      "value": "myMachine"
                  },
                  {
                      "name": "dimension2",
                      "value": "myService"
                  }
              ],
              "value": 123,
              "timestamp": "2020-12-31T08:00:00Z"
          }   

          Response Example

          Failed response example

          {
              "requestId": "45113fb2-fe84-411f-809b-9383d43003cd",
              "code": "ParameterValueException",
              "message": "The request param metricName pv of saverMetricData SaverMetricData(namespace=namespace1, metricName=pv, dimensions=[dimension1:myMachine,dimension2:myMachine], value=123, statisticValues=null, timestamp=2020-12-31T08:00:00Z) isvalid."
          }

          Interface Description

          It pushes the event data to BCM for alarm.

          Request Structure

          • Request method:POST
          • URL:/csm/api/v1/custom/event/data
          • For request body, please see the following parameter list and request example.

          List of parameters:

          RequestBody Parameters

          Name Type Description Required?
          userId String The tenant ID Yes
          namespace String Scope Yes
          eventName String Event Name Yes
          eventNameAlias String Event Alias No
          eventLevel String, optional set: CRITICAL, MAJOR, WARNING and NOTICE Event level Yes
          comment String Remarks No
          eventId String Event unique ID No
          timestamp String Time Yes
          region String Region Yes

          Response Parameter

          Name Type Description
          requestId String The request identification
          code String Return code
          message String Return information

          Request Example

          POST  /csm/api/v1/custom/event/data  HTTP/1.1  
          Host:bcm.bj.baidubce.com:80  
          {
               "userId":"user1",
               "namespace": "namespace1",
               "eventName": "event1",
               "eventNameAlias":"eventNameAlias1",
               "eventLevel":"CRITICAL",
               "comment":"{\"deviceID\":\"pd2\",\"info\":\”The number of xxx errors exceeds the limit\",\"advice\":\”Contact service personnel for repair\"}",
               "eventId": "345678fghjgjhdgsfd",
               "region":"bj",
               "timestamp": "2020-12-31T08:00:00Z"     
          }

          Response Example

          Failed response example

          {
              "requestId": "45113fb2-fe84-411f-809b-9383d43003cd",
              "code": "ParameterValueException",
              "message": "The request param eventConfigName event1 of customEventData CustomEventData(userId=user1, namespace=namespace1, eventName=event1, eventNameAlias=eventNameAlias1, eventLevel=CRITICAL, comment={\"deviceID\":\"pd2\",\"info\":\"The number of xxx errors exceeds the limit\",\"advice\":\”Contact service personnel for repair\"}, timestamp=2020-12-31T08:00:00Z, eventId=345678fghjgjhdgsfd, region=hb) isvalid."
          }
          Previous
          Custom Monitoring - Query Data Interface
          Next
          Python-SDK