16.3. Aggregating provisioned storage space

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

Aggregate the total amount of provisioned storage space per project or the amount of storage space per storage policy 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.3.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.3.1.1. Example 1

Aggregate the total amount of provisioned storage space for the project with the ID 75521ab61d1f4e9090aac5836c219492 from 12:00 PM July 18, 2021, to 13:00 PM July 19, 2021.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "operations":"(aggregate sum (metric volume.size mean))",
    "search":"project_id=75521ab61d1f4e9090aac5836c219492",
    "resource_type":"volume"
}' 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.3.1.2. Example 2

Aggregate the amount of provisioned storage space with the storage policy with the ID 10056d2e-6fc9-4f2e-92c2-dbebb1714778 from 12:00 PM July 18, 2021, to 13:00 PM July 19, 2021.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
    "operations":"(aggregate sum (metric volume.size.10056d2e-6fc9-4f2e-92c2-dbebb1714778 mean))",
    "search":"project_id=75521ab61d1f4e9090aac5836c219492",
    "resource_type":"volume"
}' 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.3.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.3.2.1. Status codes

16.3.2.1.1. Success

Code Reason
200 - OK Request was successful.

16.3.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.3.2.2. Example

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