跳转到主要内容
运维管理/监控相关接口/监控报警相关接口/时序数据(Metric)
POSTTime Series Data (Metric)起始版本 0.6同步需要认证

创建metric数据模板

创建metric数据模板

调试可用性

在线调试

使用当前认证信息和示例参数提交 Mock 请求。

请求参数

请求体字段

  • receiverUuidString必填

    接收器UUID。

  • templateString必填

    模板。

  • namespaceString必填

    命名空间。

  • metricNameString必填

    监控项名称。

  • labelsJsonStrString

    暂无描述。

响应状态

200 OK

该 API 成功时返回以下响应结构。

  • successboolean必填

    操作是否成功。

  • inventoryMetricTemplateInventory必填

    详情参考inventory

    • uuidString必填

      资源的UUID,唯一标示该资源

    • receiverUuidString必填

      接收器UUID。

    • templateString必填

      模板。

    • namespaceString必填

      命名空间。

    • metricNameString必填

      监控项名称。

    • labelsJsonStrString必填

      暂无描述。

    • descriptionString必填

      资源的详细描述

    • createDateTimestamp必填

      创建时间

    • lastOpDateTimestamp必填

      最后一次修改时间

  • errorErrorCode必填

    错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error

    • codeString必填

      错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001

    • descriptionString必填

      错误的概要描述

    • detailsString必填

      错误的详细信息

    • elaborationString必填

      保留字段,默认为null

    • opaqueLinkedHashMap必填

      保留字段,默认为null

    • causeErrorCode必填

      根错误,引发当前错误的源错误,若无原错误,该字段为null

请求地址

POST/zstack/v1/zwatch/metrics/httpreceivers/templates

/zstack/v1/zwatch/metrics/httpreceivers/templates

操作 ID

CreateMetricTemplate

永久链接

请求示例

curl -X POST 'http://{host}/zstack/v1/zwatch/metrics/httpreceivers/templates' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"receiverUuid":"<receiverUuid>","template":"<template>","namespace":"<namespace>","metricName":"<metricName>","labelsJsonStr":"<labelsJsonStr>","description":"<description>","resourceUuid":"<resourceUuid>","tagUuids":["<tagUuids>"],"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

响应示例

200
{ "inventory": { "uuid": "b143e113525d3fbaa56bf9be7fa15ccf", "receiverUuid": "95d0c874bdec350cbb963f97ae9f3a13", "template": "{ \"metricName\":\"${METRIC_NAME}\",\n \"regionId\":\"cn-shanghai\",\n \"instanceId\":\"${RESOURCE_UUID}\",\n \"resource\":\"vm/${RESOURCE_NAME}\",\n \"dimensions\":{\n \"instanceId\":\"${METRIC_LABLES.get(\u0027VMUuid\u0027)}\",\n \"device\":\"${METRIC_LABLES.get(\u0027DiskDeviceLetter\u0027)}\"\n },\n \"value\":${METRIC_VALUE},\n \"ts\":${METRIC_TIME}\n}", "namespace": "ZStack/VM", "metricName": "DiskReadOps", "labelsJsonStr": "[\u0027VMUuid\u003d95e5885772de4f2bb3e05eba98a43cd0\u0027]", "createDate": "Nov 14, 2017 2:20:57 PM", "lastOpDate": "Nov 14, 2017 2:20:57 PM" } }

变更历史

此 API 暂无变更历史记录。

查看全部变更历史