Aggregating Kubernetes clusters
POST /v1/aggregates?details=False&needed_overlap=0.0&start={start_date}&stop={stop_date}
Aggregate the number of Kubernetes clusters per project for a specific period of time.
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.
Request
Parameters
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:
|
Example
Aggregate the number of Kubernetes clusters for the project with the ID 75521ab61d1f4e9090aac5836c219492
from 12:00 PM July 18, 2021, to 13:00 PM July 19, 2021.
Kubernetes clusters may be created with an empty project ID. In this case, specify None
for the project_id
attribute.
# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d ' { "operations":"(aggregate sum (metric magnum.cluster mean))", "search":"project_id=75521ab61d1f4e9090aac5836c219492", "resource_type":"coe_cluster" }' 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
Response
Parameters
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. |
Status codes
Success
Code | Reason |
---|---|
200 - OK
|
Request was successful. |
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. |
Example
{ "measures": { "aggregated": [ [ "2021-07-18T12:00:00+00:00", 300.0, 1 ], <...> [ "2021-07-19T11:00:00+00:00", 300.0, 1 ] ] } }