Help Center/ Application Operations Management/ API Reference/ Examples/ Example 1: Querying Time Series Objects
Updated on 2023-11-16 GMT+08:00

Example 1: Querying Time Series Objects

Scenario

This section describes how to query time series objects about a node's CPU usage.

Obtaining Basic Information

Before querying time series, obtain the node ID from dimensions on the ECS console, and the cluster ID from dimensions on the cluster management page of the CCE console.

For details about the CPU usage metric, see table 1 in Host Metrics and Dimensions. For details about the name corresponding to the cluster or node ID, see table 2 in Host Metrics and Dimensions. For details about the namespace, see Table 4 QuerySeriesOptionParam.

Querying Time Series Objects

  • URI format

    POST /v2/{project_id}/series

  • Example request

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

    To obtain the value of {aom_endpoint}, see Regions and Endpoints.

    Body:

    {
        "series": [
            {
                "namespace": "PAAS.NODE",
                "metric_name": "cpuUsage",
                "dimensions":[
                    {
                        "name":"clusterId",
                        "value":"4fae3587-0202-11eb-9ba9-0255ac100b02"
                    },
                    {
                        "name":"hostID",
                        "value":"4100f512-c4e9-4b65-b0dd-2b94ea5e1a84"
                    }
                ]
            }
        ]
    }
  • Example response
    {
    	"meta_data": {
    		"count": 0,
    		"offset": 0,
    		"total": 1,
    		"nextToken": 9007148492074133276
    	},
    	"series": [{
    		"namespace": "PAAS.NODE",
    		"metric_name": "cpuUsage",
    		"unit": "Percent",
    		"dimensions": [{
    			"name": "clusterId",
    			"value": "4fae3587-0202-11eb-9ba9-0255ac100b02"
    		},
    		{
    			"name": "clusterName",
    			"value": "testdiskrate"
    		},
    		{
    			"name": "hostID",
    			"value": "4100f512-c4e9-4b65-b0dd-2b94ea5e1a84"
    		},
    		{
    			"name": "nameSpace",
    			"value": "default"
    		},
    		{
    			"name": "nodeIP",
    			"value": "192.168.0.123"
    		},
    		{
    			"name": "nodeName",
    			"value": "192.168.0.123"
    		}]
    	}]
    }