Heat incorrectly creates ceilometer-alarms when the "meter" parameter is not defined in Ceilometer

Bug #1587383 reported by Anatolii Neliubin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mirantis OpenStack
Fix Released
Low
Peter Razumovsky

Bug Description

Detailed bug description:
I try to create a new stack with only one resource which is a Ceilometer alarm. If a "meter" parameter is defined in a ceilometer, alarm is created with a correct query string: "metadata.user_metadata.stack == <stack_id>". There are situations when I need to create an alarm for a "meter", defined in pipeline.yaml. In this situation query string is changed to the "metadata.metering.metadata.user_metadata.stack == <stack_id>" value.

Steps to reproduce:
root@node-19:~# cat alarm.yaml
heat_template_version: 2015-10-15

resources:

  mem_alarm_high:
    type: OS::Ceilometer::Alarm
    properties:
      description: Scale-up if the average memory usage >= 80% for 1 minute
      meter_name: memory
      statistic: avg
      period: 60
      evaluation_periods: 1
      threshold: 80
      alarm_actions:
      matching_metadata: {"metadata.user_metadata.stack": {get_param: "OS::stack_id"}}
      comparison_operator: gt

root@node-19:~# heat stack-create -f alarm.yaml test-05311438
+--------------------------------------+---------------+--------------------+---------------------+--------------+
| id | stack_name | stack_status | creation_time | updated_time |
+--------------------------------------+---------------+--------------------+---------------------+--------------+
| 34fa084a-a72b-43df-947e-32e82a6f2c55 | test-05311438 | CREATE_IN_PROGRESS | 2016-05-31T09:38:38 | None |
+--------------------------------------+---------------+--------------------+---------------------+--------------+
root@node-19:~# ceilometer alarm-list
+--------------------------------------+-------------------------------------------+-------------------+----------+---------+------------+------------------------------+------------------+
| Alarm ID | Name | State | Severity | Enabled | Continuous | Alarm condition | Time constraints |
+--------------------------------------+-------------------------------------------+-------------------+----------+---------+------------+------------------------------+------------------+
| 06ca7544-0c80-4029-8880-b573944a2102 | test-05311438-mem_alarm_high-nxaoa6jqvcqr | insufficient data | low | True | True | memory > 80.0 during 1 x 60s | None |
+--------------------------------------+-------------------------------------------+-------------------+----------+---------+------------+------------------------------+------------------+
root@node-19:~# ceilometer alarm-show 06ca7544-0c80-4029-8880-b573944a2102
+---------------------------+----------------------------------------------------------------------+
| Property | Value |
+---------------------------+----------------------------------------------------------------------+
| alarm_actions | [] |
| alarm_id | 06ca7544-0c80-4029-8880-b573944a2102 |
| comparison_operator | gt |
| description | Scale-up if the average memory usage >= 80% for 1 minute |
| enabled | True |
| evaluation_periods | 1 |
| exclude_outliers | False |
| insufficient_data_actions | None |
| meter_name | memory |
| name | test-05311438-mem_alarm_high-nxaoa6jqvcqr |
| ok_actions | None |
| period | 60 |
| project_id | d400f2e065f84b58829cbc5b0dc30961 |
| query | metadata.user_metadata.stack == 34fa084a-a72b-43df-947e-32e82a6f2c55 |
| repeat_actions | True |
| severity | low |
| state | insufficient data |
| statistic | avg |
| threshold | 80.0 |
| type | threshold |
| user_id | f46b8fa2d32c42b6b1e9f6c2eaca145e |
+---------------------------+----------------------------------------------------------------------+
root@node-19:~# vi alarm.yaml
root@node-19:~# cat alarm.yaml
heat_template_version: 2015-10-15

resources:

  mem_alarm_high:
    type: OS::Ceilometer::Alarm
    properties:
      description: Scale-up if the average memory usage >= 80% for 1 minute
      meter_name: memory_util
      statistic: avg
      period: 60
      evaluation_periods: 1
      threshold: 80
      alarm_actions:
      matching_metadata: {"metadata.user_metadata.stack": {get_param: "OS::stack_id"}}
      comparison_operator: gt

root@node-19:~# heat stack-create -f alarm.yaml test-05311439
+--------------------------------------+---------------+--------------------+---------------------+--------------+
| id | stack_name | stack_status | creation_time | updated_time |
+--------------------------------------+---------------+--------------------+---------------------+--------------+
| 34fa084a-a72b-43df-947e-32e82a6f2c55 | test-05311438 | CREATE_COMPLETE | 2016-05-31T09:38:38 | None |
| 7decbaf8-c2ed-42f0-9210-37e521704201 | test-05311439 | CREATE_IN_PROGRESS | 2016-05-31T09:39:31 | None |
+--------------------------------------+---------------+--------------------+---------------------+--------------+
root@node-19:~# ceilometer alarm-list
+--------------------------------------+-------------------------------------------+-------------------+----------+---------+------------+-----------------------------------+------------------+
| Alarm ID | Name | State | Severity | Enabled | Continuous | Alarm condition | Time constraints |
+--------------------------------------+-------------------------------------------+-------------------+----------+---------+------------+-----------------------------------+------------------+
| 06ca7544-0c80-4029-8880-b573944a2102 | test-05311438-mem_alarm_high-nxaoa6jqvcqr | insufficient data | low | True | True | memory > 80.0 during 1 x 60s | None |
| 397b1304-5d76-4f2c-b108-a1fe0b16b770 | test-05311439-mem_alarm_high-cnwkc45vc27g | insufficient data | low | True | True | memory_util > 80.0 during 1 x 60s | None |
+--------------------------------------+-------------------------------------------+-------------------+----------+---------+------------+-----------------------------------+------------------+
root@node-19:~# ceilometer alarm-show 397b1304-5d76-4f2c-b108-a1fe0b16b770
+---------------------------+------------------------------------------------------------------+
| Property | Value |
+---------------------------+------------------------------------------------------------------+
| alarm_actions | [] |
| alarm_id | 397b1304-5d76-4f2c-b108-a1fe0b16b770 |
| comparison_operator | gt |
| description | Scale-up if the average memory usage >= 80% for 1 minute |
| enabled | True |
| evaluation_periods | 1 |
| exclude_outliers | False |
| insufficient_data_actions | None |
| meter_name | memory_util |
| name | test-05311439-mem_alarm_high-cnwkc45vc27g |
| ok_actions | None |
| period | 60 |
| project_id | d400f2e065f84b58829cbc5b0dc30961 |
| query | metadata.metering.metadata.user_metadata.stack == 7decbaf8-c2ed- |
| | 42f0-9210-37e521704201 |
| repeat_actions | True |
| severity | low |
| state | insufficient data |
| statistic | avg |
| threshold | 80.0 |
| type | threshold |
| user_id | f46b8fa2d32c42b6b1e9f6c2eaca145e |
+---------------------------+------------------------------------------------------------------+

Versions:
MOS 7, MOS 8

Expected results:
The query string in an alarm should look like: "metadata.user_metadata.stack == <stack_id>" whatever meter value we use.

Changed in mos:
assignee: nobody → Peter Razumovsky (prazumovsky)
importance: Undecided → Low
milestone: none → 10.0
Dina Belova (dbelova)
Changed in mos:
status: New → Confirmed
Revision history for this message
Peter Razumovsky (prazumovsky) wrote :

Related patch is on review: https://review.fuel-infra.org/#/c/21548/

Changed in mos:
status: Confirmed → In Progress
Revision history for this message
Peter Razumovsky (prazumovsky) wrote :

This is for 9.0 mitaka, where issue reproduced ^. Also, need fix in master.

Revision history for this message
Peter Razumovsky (prazumovsky) wrote :
Revision history for this message
Peter Razumovsky (prazumovsky) wrote :

Patch is merged to MOS master

Changed in mos:
status: In Progress → Fix Committed
Revision history for this message
Fuel Devops McRobotson (fuel-devops-robot) wrote : Change abandoned on openstack/heat (9.0/mitaka)

Change abandoned by Peter Razumovsky <email address hidden> on branch: 9.0/mitaka
Review: https://review.fuel-infra.org/21548
Reason: already merged

Changed in mos:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.