Create a Metric Data HTTP Receiver

POST/zstack/v1/zwatch/metrics/httpreceivers

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "CloudMonitor",
    "url": "http://127.0.0.1/xxx",
    "defaultEnable": true
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"CloudMonitor","url":"http://127.0.0.1/xxx","defaultEnable":true}}' \
http://localhost:8080/zstack/v1/zwatch/metrics/httpreceivers

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody (included in the params structure)Resource name 0.6
urlStringbody (included in the params structure)  0.6
description (optional)Stringbody (included in the params structure)Detailed description of the resource 0.6
defaultEnable (optional)booleanbody (included in the params structure)  0.6
resourceUuid (optional)Stringbody (included in the params structure)Resource UUID 0.6
tagUuids (optional)Listbody (included in the params structure)Tag UUID list 3.4.0
systemTags (optional)ListbodySystem tags 0.6
userTags (optional)ListbodyUser tags 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "3c4b2b282e4134579df0b8f74fb9a2b7",
    "name": "CloudMonitor",
    "url": "http://127.0.0.1/xxx",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "state": "Enabled"
  }
}
NameTypeDescriptionStarting Version
successboolean 0.6
inventoryMetricDataHttpReceiverInventoryFor details, see inventory0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID. Uniquely identifies the resource0.6
nameStringResource name0.6
urlString 0.6
descriptionStringDetailed description of the resource0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
stateReceiverStateFor details, see state0.6

state

NameTypeDescriptionStarting Version
EnabledReceiverState 0.6
DisabledReceiverState 0.6

error

NameTypeDescriptionStarting Version
codeStringError code. The globally unique error identifier, for example, SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field. Default is null0.6
opaqueLinkedHashMapReserved field. Default is null0.6
causeErrorCodeRoot error. The source error that caused the current error. This field is null if no root error exists0.6

SDK Examples

Java SDK

CreateMetricDataHttpReceiverAction action = new CreateMetricDataHttpReceiverAction();
action.name = "CloudMonitor";
action.url = "http://127.0.0.1/xxx";
action.defaultEnable = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateMetricDataHttpReceiverAction.Result res = action.call();

Python SDK

CreateMetricDataHttpReceiverAction action = CreateMetricDataHttpReceiverAction()
action.name = "CloudMonitor"
action.url = "http://127.0.0.1/xxx"
action.defaultEnable = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateMetricDataHttpReceiverAction.Result res = action.call()