autoscaling: don't query an no more existing API

This change replaces Ceilometer API query to
the corresponding Gnocchi one.

It also replaces the metering.stack to metering.server_group. Using
"stack" need change in Ceilometer and Gnocchi configuration while
server_group will work out of the box.

Change-Id: Id81539624e5bae3487757e2167bf2ccd59c0009b
This commit is contained in:
Mehdi Abaakouk 2017-06-06 10:20:50 +02:00
parent de990777bd
commit 9ac17bff58
1 changed files with 14 additions and 15 deletions

View File

@ -76,7 +76,7 @@ resources:
key_name: {get_param: key} key_name: {get_param: key}
network: {get_param: network} network: {get_param: network}
pool_id: {get_resource: pool} pool_id: {get_resource: pool}
metadata: {"metering.stack": {get_param: "OS::stack_id"}} metadata: {"metering.server_group": {get_param: "OS::stack_id"}}
user_data: user_data:
str_replace: str_replace:
template: | template: |
@ -208,23 +208,22 @@ outputs:
description: > description: >
This URL is the "external" URL that can be used to access the This URL is the "external" URL that can be used to access the
Wordpress site. Wordpress site.
ceilometer_query: gnocchi_query:
value: value:
str_replace: str_replace:
template: > template: >
ceilometer statistics -m cpu_util gnocchi measures aggregation --resource-type instance
-q metadata.user_metadata.stack=stackval -p 600 -a avg --query 'server_group="stackval"'
--granularity 300 --aggregation mean cpu_util
params: params:
stackval: { get_param: "OS::stack_id" } stackval: { get_param: "OS::stack_id" }
description: > description: >
This is a Ceilometer query for statistics on the cpu_util meter This is a Gnocchi query for statistics on the cpu_util measurements about
Samples about OS::Nova::Server instances in this stack. The -q OS::Nova::Server instances in this stack. The --resource-type select the
parameter selects Samples according to the subject's metadata. type of Gnocchi resource. The --query parameter filters resources
When a VM's metadata includes an item of the form metering.X=Y, according to its attributes. When a VM's metadata includes an item of the
the corresponding Ceilometer resource has a metadata item of the form metering.server_group=X, the corresponding Gnocchi resource has a
form user_metadata.X=Y and samples about resources so tagged can attribute named server_group that can queried with 'server_group="X"' In
be queried with a Ceilometer query term of the form this case the nested stacks give their VMs metadata that is passed as a
metadata.user_metadata.X=Y. In this case the nested stacks give nested stack parameter, and this stack passes a metadata of the form
their VMs metadata that is passed as a nested stack parameter, metering.server_group=X, where X is this stack's ID.
and this stack passes a metadata of the form metering.stack=Y,
where Y is this stack's ID.