From 8711651fc3d02b7f0932a0638b80be4fa507b88a Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Wed, 14 Aug 2013 21:55:59 +1000 Subject: [PATCH] Add a CloudWatch::Alarm implementation based on Ceilometer It's off by default for the moment so the current cloudwatch tests can run. Change-Id: Ibdce9c9223969bdcb8f2368e98dc6ab1241b84df --- etc/heat/environment.d/default.yaml | 2 + etc/heat/templates/AWS_CloudWatch_Alarm.yaml | 85 ++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 etc/heat/templates/AWS_CloudWatch_Alarm.yaml diff --git a/etc/heat/environment.d/default.yaml b/etc/heat/environment.d/default.yaml index ecc10cb056..b2bdc1099d 100644 --- a/etc/heat/environment.d/default.yaml +++ b/etc/heat/environment.d/default.yaml @@ -1,3 +1,5 @@ resource_registry: + # Choose your implementation of AWS::CloudWatch::Alarm + #"AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml" "AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm" diff --git a/etc/heat/templates/AWS_CloudWatch_Alarm.yaml b/etc/heat/templates/AWS_CloudWatch_Alarm.yaml new file mode 100644 index 0000000000..1f8fea96dc --- /dev/null +++ b/etc/heat/templates/AWS_CloudWatch_Alarm.yaml @@ -0,0 +1,85 @@ +HeatTemplateFormatVersion: '2012-12-12' +Description: AWS::CloudWatch::Alarm using Ceilometer. +Parameters: + AlarmDescription: + Type: String + Default: An alarm + EvaluationPeriods: + Type: String + MetricName: + Type: String + Namespace: + Type: String + Default: system/linux + Period: + Type: String + ComparisonOperator: + Type: String + AllowedValues: [GreaterThanOrEqualToThreshold, GreaterThanThreshold, + LessThanThreshold, LessThanOrEqualToThreshold] + Statistic: + Type: String + AllowedValues: [SampleCount, Average, Sum, Minimum, Maximum] + Threshold: + Type: String + Units: + Type: String + AllowedValues: [Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, + Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, + Gigabits, Terabits, Percent, Count, Bytes/Second, + Kilobytes/Second, Megabytes/Second, Gigabytes/Second, + Terabytes/Second, Bits/Second, Kilobits/Second, + Megabits/Second, Gigabits/Second, Terabits/Second, + Count/Second, None] + Default: None + AlarmActions: + Type: CommaDelimitedList + Default: '' + OKActions: + Type: CommaDelimitedList + Default: '' + InsufficientDataActions: + Type: CommaDelimitedList + Default: '' + Dimensions: + Type: CommaDelimitedList + +Mappings: + ComparisonOperatorMap: + LessThanOrEqualToThreshold: {Ceilometer: le} + LessThanThreshold: {Ceilometer: lt} + GreaterThanThreshold: {Ceilometer: gt} + GreaterThanOrEqualToThreshold: {Ceilometer: ge} + StatisticMap: + SampleCount: {Ceilometer: count} + Average: {Ceilometer: avg} + Sum: {Ceilometer: sum} + Minimum: {Ceilometer: min} + Maximum: {Ceilometer: max} + +Resources: + __alarm__: + Type: OS::Metering::Alarm + Properties: + description: + Ref: AlarmDescription + counter_name: + Ref: MetricName + period: + Ref: Period + evaluation_periods: + Ref: EvaluationPeriods + threshold: + Ref: Threshold + alarm_actions: + "Fn::Split": [",", {Ref: AlarmActions}] + ok_actions: + "Fn::Split": [",", {Ref: OKActions}] + insufficient_data_actions: + "Fn::Split": [",", {Ref: InsufficientDataActions}] + statistic: + "Fn::FindInMap": [StatisticMap, {Ref: Statistic}, Ceilometer] + comparison_operator: + "Fn::FindInMap": [ComparisonOperatorMap, {Ref: ComparisonOperator}, Ceilometer] + matching_metadata: + "Fn::MemberListToMap": [Name, Value, {"Fn::Split": [",", {Ref: Dimensions}]}]