-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws - cloud watch alarm - add a filter for determining if part of a c…
…omposite alarm (#9300)
- Loading branch information
1 parent
7952c6c
commit ea06851
Showing
10 changed files
with
386 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/data/placebo/test_is_composite_child_filter/monitoring.DescribeAlarms_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"CompositeAlarms": [], | ||
"MetricAlarms": [ | ||
{ | ||
"AlarmName": "c7n-test-alarm-tags-filter", | ||
"AlarmArn": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:c7n-test-alarm-tags-filter", | ||
"AlarmConfigurationUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2021, | ||
"month": 3, | ||
"day": 24, | ||
"hour": 18, | ||
"minute": 1, | ||
"second": 32, | ||
"microsecond": 583000 | ||
}, | ||
"ActionsEnabled": true, | ||
"OKActions": [], | ||
"AlarmActions": [], | ||
"InsufficientDataActions": [], | ||
"StateValue": "INSUFFICIENT_DATA", | ||
"StateReason": "Insufficient Data: 5 datapoints were unknown.", | ||
"StateReasonData": "{\"version\":\"1.0\",\"queryDate\":\"2022-09-27T10:05:12.193+0000\",\"statistic\":\"Average\",\"period\":3600,\"recentDatapoints\":[],\"threshold\":10.0,\"evaluatedDatapoints\":[{\"timestamp\":\"2022-09-27T09:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T08:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T07:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T06:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T05:05:00.000+0000\"}]}", | ||
"StateUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2022, | ||
"month": 9, | ||
"day": 27, | ||
"hour": 10, | ||
"minute": 5, | ||
"second": 12, | ||
"microsecond": 198000 | ||
}, | ||
"MetricName": "CPUUtilization", | ||
"Namespace": "AWS/EC2", | ||
"Statistic": "Average", | ||
"Dimensions": [], | ||
"Period": 3600, | ||
"EvaluationPeriods": 5, | ||
"Threshold": 10.0, | ||
"ComparisonOperator": "GreaterThanThreshold", | ||
"StateTransitionedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2022, | ||
"month": 9, | ||
"day": 27, | ||
"hour": 10, | ||
"minute": 5, | ||
"second": 12, | ||
"microsecond": 198000 | ||
} | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/data/placebo/test_is_composite_child_filter/monitoring.DescribeAlarms_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"CompositeAlarms": [ | ||
{ | ||
"ActionsEnabled": true, | ||
"AlarmActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:test-xyz" | ||
], | ||
"AlarmArn": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:ExampleCompositeAlarm", | ||
"AlarmConfigurationUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 16, | ||
"hour": 16, | ||
"minute": 32, | ||
"second": 54, | ||
"microsecond": 256000 | ||
}, | ||
"AlarmDescription": "Composite alarm based on c7n-test-alarm-tags-filter", | ||
"AlarmName": "ExampleCompositeAlarm", | ||
"AlarmRule": "ALARM(c7n-test-alarm-tags-filter)", | ||
"InsufficientDataActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:test-zyx" | ||
], | ||
"OKActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:test-xyz" | ||
], | ||
"StateReason": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:ExampleCompositeAlarm was created and its alarm rule evaluates to OK", | ||
"StateReasonData": "{\"triggeringAlarms\":[{\"arn\":\"arn:aws:cloudwatch:us-east-1:644160558196:alarm:c7n-test-alarm-tags-filter\",\"state\":{\"value\":\"INSUFFICIENT_DATA\",\"timestamp\":\"2022-09-27T10:05:12.198+0000\"}}]}", | ||
"StateUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 16, | ||
"hour": 16, | ||
"minute": 32, | ||
"second": 54, | ||
"microsecond": 256000 | ||
}, | ||
"StateValue": "OK", | ||
"StateTransitionedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 16, | ||
"hour": 16, | ||
"minute": 32, | ||
"second": 54, | ||
"microsecond": 256000 | ||
} | ||
} | ||
], | ||
"MetricAlarms": [], | ||
"ResponseMetadata": {} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/data/placebo/test_is_composite_child_filter/tagging.GetResources_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"PaginationToken": "", | ||
"ResourceTagMappingList": [ | ||
{ | ||
"ResourceARN": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:c7n-test-alarm-tags-filter", | ||
"Tags": [ | ||
{ | ||
"Key": "some-tag", | ||
"Value": "some-value" | ||
}, | ||
{ | ||
"Key": "OwnerName", | ||
"Value": "SomeName" | ||
}, | ||
{ | ||
"Key": "pratyush", | ||
"Value": "test" | ||
} | ||
] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/data/placebo/test_is_composite_child_filter/tagging.GetResources_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"PaginationToken": "", | ||
"ResourceTagMappingList": [ | ||
{ | ||
"ResourceARN": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:ExampleCompositeAlarm", | ||
"Tags": [] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/data/placebo/test_is_not_composite_child_filter/monitoring.DescribeAlarms_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"CompositeAlarms": [], | ||
"MetricAlarms": [ | ||
{ | ||
"AlarmName": "c7n-test-alarm-tags-filter", | ||
"AlarmArn": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:c7n-test-alarm-tags-filter", | ||
"AlarmConfigurationUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2021, | ||
"month": 3, | ||
"day": 24, | ||
"hour": 18, | ||
"minute": 1, | ||
"second": 32, | ||
"microsecond": 583000 | ||
}, | ||
"ActionsEnabled": true, | ||
"OKActions": [], | ||
"AlarmActions": [], | ||
"InsufficientDataActions": [], | ||
"StateValue": "INSUFFICIENT_DATA", | ||
"StateReason": "Insufficient Data: 5 datapoints were unknown.", | ||
"StateReasonData": "{\"version\":\"1.0\",\"queryDate\":\"2022-09-27T10:05:12.193+0000\",\"statistic\":\"Average\",\"period\":3600,\"recentDatapoints\":[],\"threshold\":10.0,\"evaluatedDatapoints\":[{\"timestamp\":\"2022-09-27T09:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T08:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T07:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T06:05:00.000+0000\"},{\"timestamp\":\"2022-09-27T05:05:00.000+0000\"}]}", | ||
"StateUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2022, | ||
"month": 9, | ||
"day": 27, | ||
"hour": 10, | ||
"minute": 5, | ||
"second": 12, | ||
"microsecond": 198000 | ||
}, | ||
"MetricName": "CPUUtilization", | ||
"Namespace": "AWS/EC2", | ||
"Statistic": "Average", | ||
"Dimensions": [], | ||
"Period": 3600, | ||
"EvaluationPeriods": 5, | ||
"Threshold": 10.0, | ||
"ComparisonOperator": "GreaterThanThreshold", | ||
"StateTransitionedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2022, | ||
"month": 9, | ||
"day": 27, | ||
"hour": 10, | ||
"minute": 5, | ||
"second": 12, | ||
"microsecond": 198000 | ||
} | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/data/placebo/test_is_not_composite_child_filter/monitoring.DescribeAlarms_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"CompositeAlarms": [ | ||
{ | ||
"ActionsEnabled": true, | ||
"AlarmActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:test-xyz" | ||
], | ||
"AlarmArn": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:ExampleCompositeAlarm", | ||
"AlarmConfigurationUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 16, | ||
"hour": 16, | ||
"minute": 32, | ||
"second": 54, | ||
"microsecond": 256000 | ||
}, | ||
"AlarmDescription": "Composite alarm based on c7n-test-alarm-tags-filter", | ||
"AlarmName": "ExampleCompositeAlarm", | ||
"AlarmRule": "ALARM(c7n-test-alarm-tags-filter)", | ||
"InsufficientDataActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:test-zyx" | ||
], | ||
"OKActions": [ | ||
"arn:aws:sns:us-east-1:644160558196:test-xyz" | ||
], | ||
"StateReason": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:ExampleCompositeAlarm was created and its alarm rule evaluates to OK", | ||
"StateReasonData": "{\"triggeringAlarms\":[{\"arn\":\"arn:aws:cloudwatch:us-east-1:644160558196:alarm:c7n-test-alarm-tags-filter\",\"state\":{\"value\":\"INSUFFICIENT_DATA\",\"timestamp\":\"2022-09-27T10:05:12.198+0000\"}}]}", | ||
"StateUpdatedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 16, | ||
"hour": 16, | ||
"minute": 32, | ||
"second": 54, | ||
"microsecond": 256000 | ||
}, | ||
"StateValue": "OK", | ||
"StateTransitionedTimestamp": { | ||
"__class__": "datetime", | ||
"year": 2024, | ||
"month": 2, | ||
"day": 16, | ||
"hour": 16, | ||
"minute": 32, | ||
"second": 54, | ||
"microsecond": 256000 | ||
} | ||
} | ||
], | ||
"MetricAlarms": [], | ||
"ResponseMetadata": {} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/data/placebo/test_is_not_composite_child_filter/tagging.GetResources_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"PaginationToken": "", | ||
"ResourceTagMappingList": [ | ||
{ | ||
"ResourceARN": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:c7n-test-alarm-tags-filter", | ||
"Tags": [ | ||
{ | ||
"Key": "some-tag", | ||
"Value": "some-value" | ||
}, | ||
{ | ||
"Key": "OwnerName", | ||
"Value": "SomeName" | ||
}, | ||
{ | ||
"Key": "pratyush", | ||
"Value": "test" | ||
} | ||
] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/data/placebo/test_is_not_composite_child_filter/tagging.GetResources_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"status_code": 200, | ||
"data": { | ||
"PaginationToken": "", | ||
"ResourceTagMappingList": [ | ||
{ | ||
"ResourceARN": "arn:aws:cloudwatch:us-east-1:644160558196:alarm:ExampleCompositeAlarm", | ||
"Tags": [] | ||
} | ||
], | ||
"ResponseMetadata": {} | ||
} | ||
} |
Oops, something went wrong.