If want to used clusetr_id, here was my step:
1. Add gnocchi resource-type instance with cluster_id attributes(I used gnocchi API): https://gnocchi.xyz/rest.html#id21
Body: [ { "op": "add", "path": "/attributes/cluster_id", "value": { "type": "string", "min_length": 0, "max_length": 255, "required": false } } ]
2. Modify ceilometer gnocchi_resources.yaml (ceilometer/publisher/data/gnocchi_resources.yaml) https://github.com/openstack/ceilometer/blob/master/ceilometer/publisher/data/gnocchi_resources.yaml#L111
Under the server_group, add this line: cluster_id: resource_metadata.user_metadata.cluster_id
3. Restart ceilometer service (Both controller and compute)
4. Modify aodh rest.py(aodh/notifier/rest.py) https://github.com/openstack/aodh/blob/master/aodh/notifier/rest.py#L79
Under the headers['content-type'] , add this line: headers['openstack-api-version'] = 'clustering 1.10'
5. Restart aodh service
6. create aodh alarm:
aodh alarm create \ --type gnocchi_aggregation_by_resources_threshold \ --name cpu-high \ --metric cpu_util \ --threshold 70 \ --comparison-operator gt \ --description 'instance running hot' \ --evaluation-periods 1 \ --aggregation-method mean \ --alarm-action $ALRM_URL01 \ --granularity 60 \ --repeat-actions False \ --query '{"=": {"cluster_id": "$MYCLUSTER_ID""}}' \ --resource-type instance
If want to used clusetr_id,
here was my step:
1. Add gnocchi resource-type instance with cluster_id attributes(I used gnocchi API): /gnocchi. xyz/rest. html#id21
https:/
Body: cluster_ id",
[
{
"op": "add",
"path": "/attributes/
"value": {
"type": "string",
"min_length": 0,
"max_length": 255,
"required": false
}
}
]
2. Modify ceilometer gnocchi_ resources. yaml (ceilometer/ publisher/ data/gnocchi_ resources. yaml) /github. com/openstack/ ceilometer/ blob/master/ ceilometer/ publisher/ data/gnocchi_ resources. yaml#L111
https:/
Under the server_group, add this line: metadata. user_metadata. cluster_ id
cluster_id: resource_
3. Restart ceilometer service (Both controller and compute)
4. Modify aodh rest.py( aodh/notifier/ rest.py) /github. com/openstack/ aodh/blob/ master/ aodh/notifier/ rest.py# L79
https:/
Under the headers[ 'content- type'] , add this line: 'openstack- api-version' ] = 'clustering 1.10'
headers[
5. Restart aodh service
6. create aodh alarm:
aodh alarm create \ aggregation_ by_resources_ threshold \ operator gt \ periods 1 \ method mean \
--type gnocchi_
--name cpu-high \
--metric cpu_util \
--threshold 70 \
--comparison-
--description 'instance running hot' \
--evaluation-
--aggregation-
--alarm-action $ALRM_URL01 \
--granularity 60 \
--repeat-actions False \
--query '{"=": {"cluster_id": "$MYCLUSTER_ID""}}' \
--resource-type instance