应用运维管理 AOM-数据订阅:数据订阅格式说明

时间:2024-11-02 18:44:39

数据订阅格式说明

  • AOM 格式的指标JSON格式代码片断
    package metric
    
    type MetricDatas struct {
       Metrics   []Metrics `json:"metrics"`
       ProjectId string    `json:"project_id"`
    }
    
    type Metrics struct {
       Metric      Metric  `json:"metric"`
       Values      []Value `json:"values"`
       CollectTime int64   `json:"collect_time"`
    }
    
    type Metric struct {
       Namespace  string      `json:"namespace"`
       Dimensions []Dimension `json:"dimensions"`
    }
    
    type Value struct {
       Value           interface{} `json:"value"`
       Type            string      `json:"type"`
       Unit            string      `json:"unit"`
       StatisticValues string      `json:"statisticvalues"`
       MetricName      string      `json:"metric_name"`
    }
    
    type Dimension struct {
       Name  string `json:"name"`
       Value string `json:"value"`
    }
    
  • kafka消息示例
    key:,
    value:{"metrics":[{"metric":{"namespace":"PAAS.NODE","dimensions":[{"name":"nodeName","value":"test-vss-cop-master-1"},{"name":"nodeIP","value":"1.1.1.1"},{"name":"hostID","value":"75d97111-4734-4c6c-ae9e-f6111111111"},{"name":"nameSpace","value":"default"},{"name":"clusterId","value":"46a7bc0d-1d8b-11ea-9b04-333333333333333"},{"name":"clusterName","value":"test-vss-111"},{"name":"diskDevice","value":"vda"},{"name":"master","value":"true"}]},"values":[{"value":0,"type":"","unit":"Kilobytes/Second","statisticvalues":"","metric_name":"diskReadRate"},{"value":30.267,"type":"","unit":"Kilobytes/Second","statisticvalues":"","metric_name":"diskWriteRate"}],"collect_time":1597821030037}],"project_id":"111111111111111111111"}
  • 告警数据格式说明

    示例:

    {
        "events": [{
            "id": "4346299651651991683",
            "starts_at": 1597822250194,
            "ends_at": 0,
            "arrives_at": 1597822250194,
            "timeout": 300000,
            "resource_group_id": "312313123112222222222232131312131",
            "metadata": {
                "kind": "Pod",
                "event_severity": "Major",
                "resource_type": "service",
                "clusterId": "6add4ef5-1358-11ea-a5bf-111111111",
                "event_type": "alarm",
                "clusterName": "cce-ief-4516140c-96ca-4a5f-8d85-1111111",
                "namespace": "PAAS.NODE",
                "name": "test15769793809553052-f5557bd7f-qnfkm",
                "event_name": "调度失败##FailedScheduling",
                "resource_id": "clusterName=cce-ief-4516140c-96ca-4a5f-8d85-111111;clusterID=6add4ef5-1358-11ea-a5bf-11111111111;kind=Pod;namespace=30d5758f166947c6b164af604a654b09;name=test15769793809553052-f5557bd7f-qnfkm;uid=589fc746-245d-11ea-a465-fa163e5fc15d",
                "nameSpace": "30d5758f166947c6b164af604a654b09",
                "resource_provider": "CCE",
                "nodeID": "589fc746-245d-11ea-a465-fa163e5fc15d"
            },
            "annotations": {
                "alarm_probableCause_zh_cn": "FailedScheduling",
                "alarm_probableCause_en_us": "FailedScheduling",
                "message": "0/110 nodes are available: 1 node(s) had taints that the pod didn't tolerate, 109 node(s) didn't match node selector."
            },
            "attach_rule": {
                
            }
        }],
        "project_id": "312313123112222222222232131312131"
    }

    参数说明:

    表4 告警参数

    参数

    参数类型

    描述

    events

    Array ofobjects,详见 表5

    事件或者告警详情。

    project_id

    String

    租户从 IAM 申请到的projectid,一般为32位字符串。

    表5 EventModel

    参数

    参数类型

    描述

    id

    String

    事件或者告警id,系统自动生成。

    starts_at

    Long

    事件或者告警产生的时间, CS T毫秒级时间戳。

    ends_at

    Long

    事件或者告警清除的时间,CST毫秒级时间戳,为0时表示未删除。

    arrives_at

    Long

    事件或者告警到达AOM的时间,CST毫秒级时间戳。

    timeout

    Long

    告警自动清除时间。毫秒数,例如一分钟则填写为60000。默认清除时间为3天。

    resource_group_id

    String

    资源组预留字段,当前默认和projectid的值一样。

    metadata

    Object

    事件或者告警的详细信息,为键值对形式。必须字段为:

    • event_name:事件或者告警名称,类型为String;
    • event_severity:事件级别枚举值。类型为String,四种类型 "Critical", "Major", "Minor", "Info";
    • event_type:事件类别枚举值。类型为String,event为普通告警,alarm为告警事件;
    • resource_provider:事件对应云服务名称。类型为String;
    • resource_type:事件对应资源类型。类型为String;
    • resource_id:事件对应资源信息。类型为String。

    annotations

    Object

    事件或者告警附加字段,可以为空。

    attach_rule

    Object

    事件或者告警预留字段,为空。

support.huaweicloud.com/usermanual-aom/aom_02_1013.html