文档首页 > > API参考> 应用示例>

示例2:查询时序数据

示例2:查询时序数据

分享
更新时间:2020/12/26 GMT+08:00

场景描述

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

涉及的基本信息

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

CPU使用率metric_name可以在“主机指标及其维度-表1”中查看,集群ID和节点ID在dimensions中,name可以在“主机指标及其维度-表2”中查看,namespace可以在ListSeries.html#ZH-CN_TOPIC_0000001073248404__zh-cn_topic_0295535326_request_QuerySeriesOptionParam中查看。

查询时序数据

  • 接口相关信息

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

  • 请求示例

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

    {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
    			}]
    		}]
    	}]
    }
分享:

    相关文档

    相关产品