更新时间:2024-01-04 GMT+08:00
分享

查询时序数据

场景描述

本章以查询一个节点的CPU使用率时序数据为例。

涉及的基本信息

查询时序数据前,需要确定节点的ID和集群ID,节点ID可以在ECS的dimensions中查看,集群ID可以在CCE的“集群管理”页面,基本信息的dimensions中查看。

CPU使用率metric_name可以在主机指标中查看,集群ID和节点ID各自对应的name可以在主机指标-维度中查看,namespace可以在表4 QuerySeriesOptionParam中查看。

查询时序数据

  • 接口相关信息

    URI格式:POST /v2/{project_id}/samples

  • 请求示例

    POST https://{aom_endpoint}/v2/{project_id}/samples

    {aom_endpoint}信息请从地区和终端节点获取。

    Body:

    {  
        "samples": [  
            {  
                "namespace": "PAAS.NODE",  
                "metric_name": "cpuUsage",
                   "dimensions": [ {  
                        "name": "clusterId",  
                        "value": "4fae3587-0202-11eb-9ba9-0255ac100b02"  
                    },
                    {  
                        "name": "hostID",  
                        "value": "4100f512-c4e9-4b65-b0dd-2b94ea5e1a84"  
                    }
                ]  
            }  
        ],  
        "period": 60,  
        "time_range": "-1.-1.2", 
        "statistics": [  
            "maximum",  
            "minimum",  
            "sum"  
        ]  
    }
  • 响应示例
    {
    	"samples": [{
    		"sample": {
    			"namespace": "PAAS.NODE",
    			"metric_name": "cpuUsage",
    			"dimensions": [{
    				"name": "clusterId",
    				"value": "4fae3587-0202-11eb-9ba9-0255ac100b02"
    			},
    			{
    				"name": "hostID",
    				"value": "4100f512-c4e9-4b65-b0dd-2b94ea5e1a84"
    			}]
    		},
    		"data_points": [{
    			"timestamp": 1608191880000,
    			"unit": "Percent",
    			"statistics": [{
    				"statistic": "maximum",
    				"value": 14.5
    			},
    			{
    				"statistic": "minimum",
    				"value": 14.5
    			},
    			{
    				"statistic": "sum",
    				"value": 14.5
    			}]
    		},
    		{
    			"timestamp": 1608191940000,
    			"unit": "Percent",
    			"statistics": [{
    				"statistic": "maximum",
    				"value": 12.0
    			},
    			{
    				"statistic": "minimum",
    				"value": 12.0
    			},
    			{
    				"statistic": "sum",
    				"value": 12.0
    			}]
    		}]
    	}]
    }
分享:

    相关文档

    相关产品