Cloud watch alarms don't work via Ceilometer

Bug #1373247 reported by Angus Salkeld
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Angus Salkeld

Bug Description

If you use https://github.com/openstack/heat/blob/master/etc/heat/templates/AWS_CloudWatch_Alarm.yaml the ceilometer alarm create will fail.

The reason for this is the "metadata.metering." string is not prepended to the dimension Name.

Say you have the following:
resources:
  server_alarm:
    type: "AWS::CloudWatch::Alarm"
    properties:
      MetricName: heartbeat
      Period: "60"
      EvaluationPeriods: "1"
      Threshold: "1"
      AlarmActions:
      - http://example.com/foo
      ComparisonOperator: LessThanThreshold
      Dimensions:
      -
        Name: AlarmName
        Value: server_alarm
      Statistic: SampleCount

The dimension do get correctly reformatted, but they get passed in as kwargs into alarm create.
They need "metadata.metering." prepended.

This does not make sense to me: https://github.com/openstack/heat-templates/commit/bc081a1031ec6de4161f5ede0eb7221f46354d0d
(I'll check with therve).

Because this works for me:
 ceilometer sample-list -q "metadata.metering.AlarmName=server_alarm" -m heartbeat
+-------------+-----------+-------+--------+--------+----------------------------+
| Resource ID | Name | Type | Volume | Unit | Timestamp |
+-------------+-----------+-------+--------+--------+----------------------------+
| 345 | heartbeat | gauge | 77.0 | sample | 2014-09-24T05:55:17.179539 |

I need to get to the bottom of the "metering"/"user_metadata" issue.

Revision history for this message
Angus Salkeld (asalkeld) wrote :

When ever we create a server we add "metering.InstanceId=<>" and when ever
we create a server as a part of an autoscaling group we add "metering.group=<groupid>" to the server's metadata.
Then Ceilometer looks for metadata with the prefix "metering." and adds that to the sample metadata.
Have a look here: https://github.com/openstack/ceilometer/blob/master/ceilometer/compute/util.py#L34

So if you are using Ceilometer alarms based on:

1) nova metrics, then your alarm.matching_metadata needs to be "user_metadata.<bla>"

2) any other means (cfn-push-stats/ceilometer client) then your alarm.matching_metadata needs to be "metering.<bla>"

Angus Salkeld (asalkeld)
Changed in heat:
assignee: nobody → Angus Salkeld (asalkeld)
importance: Undecided → High
status: New → Triaged
milestone: none → juno-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/123989

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/123990

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/123989
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=b0903a5598b6812342e230a03ff0310d068cb450
Submitter: Jenkins
Branch: master

commit b0903a5598b6812342e230a03ff0310d068cb450
Author: Angus Salkeld <email address hidden>
Date: Thu Sep 25 17:37:37 2014 +1000

    Make sure that AutoScaling group has it's tag set correctly

    At the moment we have to rely on the base classes metering.groupname
    and this AutoScalingGroupName is effectively lost.

    Change-Id: I6f4c099bde83fba5ad89e43297503943136b717e
    Partial-bug: #1373247

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/123990
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=3f73f82a0d4370b6a938fd5d5df6b7c91639d023
Submitter: Jenkins
Branch: master

commit 3f73f82a0d4370b6a938fd5d5df6b7c91639d023
Author: Angus Salkeld <email address hidden>
Date: Thu Sep 25 15:30:46 2014 +1000

    Don't pass empty action strings to ceilometer

    Note: this only really happens when using the cloud watch
    resource template.

    Partial-bug: #1373247
    Change-Id: I084d28dfbbd0f2d7a6a18a09600f86880fa394d5

Revision history for this message
Zane Bitter (zaneb) wrote :

I assume this is fixed, because all patches in the series have merged.

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-rc1 → 2014.2
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.