16.1. Aggregating provisioned vCPUs

POST /v1/aggregates?details=False&needed_overlap=0.0&start={start_date}&stop={stop_date}

Aggregate the number of provisioned vCPUs per project for a specific period of time.

Note

If the start or stop date is not specified, the missing value will be set to the first or last timestamp common across the time series.

16.1.1. Request

Name In Type Description
operation body string Operations to apply to the time series. For aggregation across metrics, use the following syntax: aggregate <aggregation_method> ((metric <metric_id> <aggregation_method>), ...). Supported aggregation methods are: mean, median, std, min, max, sum, var, count.
search body string A query to filter resources. The syntax includes an attribute, operator, and value. For example, the query id=90d58eea-70d7-4294-a49a-170dcdf44c3c will filter a resource with the specified ID. You can use more complex queries, for example, not (flavor_id!=”1” and memory>=24). Use “” to interpret data as a string. Supported operators are: not, and, ∧ or, ∨, >=, <=, !=, >, <, =, ==, eq, ne, lt, gt, ge, le, in, like, ≠, ≥, ≤, like, in.
resource_type body string

A resource type that a metric is associated with. For example, these metrics are bound to:

  • vCPU and RAM metrics—the instance resource type
  • Storage metrics—the volume resource type
  • Floating IP addresses—the network resource type
  • Load balancers—the loadbalancer resource type
  • Kubernetes clusters—the coe_cluster resource type

16.1.1.1. Example

Aggregate the number of provisioned vCPUs for the project with the ID 75521ab61d1f4e9090aac5836c219492 from 12:00 PM July 18, 2021, to 12:00 PM July 19, 2021.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "operations":"(aggregate sum (metric vcpus mean))",
    "search":"project_id=75521ab61d1f4e9090aac5836c219492",
    "resource_type":"instance"
}' https://<node_IP_addr>:8041/v1/aggregates?details=False&needed_overlap=0.0&\
start=2021-07-18T12:00:00&stop=2021-07-19T12:00:00

16.1.2. Response

Name In Type Description
measures body string A list of measures for a metric.
aggregated body array A number of aggregates, each consisting of a timestamp, granularity, and value.

16.1.2.1. Status codes

16.1.2.1.1. Success

Code Reason
200 - OK Request was successful.

16.1.2.1.2. Error

Code Reason
400 - Bad Request Some content in the request was invalid.
401 - Unauthorized User must authenticate before making a request.
403 - Forbidden Policy does not allow current user to do this operation.
404 - Not Found The requested resource could not be found.
500 - Internal Server Error Something went wrong inside the service. This should not happen usually. If it does happen, it means the server has experienced some serious problems.
503 - Service Unavailable Service is not available. This is mostly caused by service configuration errors which prevents the service from successful start up.

16.1.2.2. Example

{
  "measures": {
    "aggregated": [
      [
        "2021-07-19T12:00:00+00:00",
        300.0,
        6.0
      ],
      ...
      [
        "2021-07-19T11:00:00+00:00",
        300.0,
        6.0
      ] 
    ]
  }
}