cfn-guardian 0.7.9 → 0.7.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/README.md +1 -0
- data/docs/event_subscriptions.md +17 -5
- data/docs/overview.md +1 -1
- data/docs/resources.md +3 -0
- data/lib/cfnguardian/compile.rb +3 -0
- data/lib/cfnguardian/config/defaults.yaml +2 -0
- data/lib/cfnguardian/models/alarm.rb +32 -0
- data/lib/cfnguardian/resources/dms_cluster.rb +40 -0
- data/lib/cfnguardian/resources/dms_task.rb +42 -0
- data/lib/cfnguardian/resources/documentdb_cluster.rb +40 -0
- data/lib/cfnguardian/resources/ec2_instance.rb +3 -2
- data/lib/cfnguardian/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a230076e5d4d93c1a41be549943f3dbb745662a8faaf04afc176a1b75d3cc8f
|
4
|
+
data.tar.gz: 036a95941c4c8e50641d4ee7e0bfdb4e2f842b125756898599af3055843ca8f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d54543ea87af6922725b6d5955b0f473d037be50de85eca77e6925f5534307ed37648085befc64a3f6753ccd0224ef00f65b666e1109324925596858c2cdd85b
|
7
|
+
data.tar.gz: bc5d74d51b7559bb5d3ddcabfc8ef9a0cac3b4e1f679e1267d41149a3f6ebc2108962cbd19e4eda8eb1b96c4e574711ee7fc63e8a955495e54796f33ecd217b9
|
data/Dockerfile
CHANGED
data/README.md
CHANGED
data/docs/event_subscriptions.md
CHANGED
@@ -10,14 +10,14 @@ As with the default alarms in Guardian, there are default events for some resour
|
|
10
10
|
|
11
11
|
## Overriding Defaults
|
12
12
|
|
13
|
-
Default
|
13
|
+
Default properties of the events can be overridden through the config YAML using the `EventsSubscriptions` top level key.
|
14
14
|
For example here we are changing the topic the event is being send to.
|
15
15
|
|
16
16
|
```yaml
|
17
17
|
Topics:
|
18
18
|
CustomEvents: arn:aws:sns....
|
19
19
|
|
20
|
-
|
20
|
+
EventSubscriptions:
|
21
21
|
Ec2Instance:
|
22
22
|
InstanceTerminated:
|
23
23
|
Topic: CustomEvents
|
@@ -28,12 +28,24 @@ EventSubscription:
|
|
28
28
|
Default events can be disabled, the same way default alarms can be disabled through the config YAML.
|
29
29
|
|
30
30
|
```yaml
|
31
|
-
|
31
|
+
EventSubscriptions:
|
32
32
|
Ec2Instance:
|
33
33
|
# set the instance terminated event to false to disable the event
|
34
34
|
InstanceTerminated: false
|
35
35
|
```
|
36
36
|
|
37
|
+
## Enabling Default Events
|
38
|
+
|
39
|
+
Some templates may have events that are disabled by default, they can be enabled using a slightly different syntax to disabling.
|
40
|
+
|
41
|
+
```yaml
|
42
|
+
EventSubscriptions:
|
43
|
+
RDSInstance:
|
44
|
+
# set the replication failure event to true to enable the event
|
45
|
+
ReplicationFailure:
|
46
|
+
Enabled: true
|
47
|
+
```
|
48
|
+
|
37
49
|
## Creating Custom Events
|
38
50
|
|
39
51
|
Custom events can be created if there are not defaults for that event. They can be inherited from a default event or from the base event model.
|
@@ -44,7 +56,7 @@ This is useful if you want to create a new event and a default event already has
|
|
44
56
|
The following example inherits the `MasterPasswordReset` RDS event and creates a new event that captures the security group add to an rds instance event.
|
45
57
|
|
46
58
|
```yaml
|
47
|
-
|
59
|
+
EventSubscriptions:
|
48
60
|
RDSInstance:
|
49
61
|
# Create a new event name
|
50
62
|
DBNewSecurityGroup:
|
@@ -59,7 +71,7 @@ EventSubscription:
|
|
59
71
|
If there are no default events that match the format you require you can create an event of the base event subscription model.
|
60
72
|
|
61
73
|
```yaml
|
62
|
-
|
74
|
+
EventSubscriptions:
|
63
75
|
ECSCluster:
|
64
76
|
ContainerInstanceStateChange:
|
65
77
|
Source: aws.ecs
|
data/docs/overview.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
3. [Alarm Templates](alarm_templates.md)
|
7
7
|
4. Custom Checks
|
8
8
|
1. [HTTP](custom_checks/http.md)
|
9
|
-
2. [Domain
|
9
|
+
2. [Domain Expiry](custom_checks/domain_expiry.md)
|
10
10
|
3. [LogGroup Metric Filters](custom_checks/log_group_metric_filters.md)
|
11
11
|
4. [NRPE](custom_checks/nrpe.md)
|
12
12
|
5. [Port](custom_checks/port.md)
|
data/docs/resources.md
CHANGED
@@ -39,6 +39,7 @@ Resources:
|
|
39
39
|
| ApiGateway | Id |
|
40
40
|
| AmazonMQBroker | Id |
|
41
41
|
| AutoScalingGroup | Id |
|
42
|
+
| DocumentDBCluster | Id |
|
42
43
|
| DynamoDBTable | Id |
|
43
44
|
| ElastiCacheReplicationGroup | Id |
|
44
45
|
| ElasticFileSystem | Id |
|
@@ -55,6 +56,8 @@ Resources:
|
|
55
56
|
| CloudFrontDistribution | Id |
|
56
57
|
| SQSQueue | Id |
|
57
58
|
| ElasticSearch | Id, Domain |
|
59
|
+
| DMSCluster | Id |
|
60
|
+
| DMSTask | Id, Instance |
|
58
61
|
|
59
62
|
|
60
63
|
## Custom Resource Groups
|
data/lib/cfnguardian/compile.rb
CHANGED
@@ -12,6 +12,9 @@ require 'cfnguardian/resources/autoscaling_group'
|
|
12
12
|
require 'cfnguardian/resources/cloudfront_distribution'
|
13
13
|
require 'cfnguardian/resources/autoscaling_group'
|
14
14
|
require 'cfnguardian/resources/domain_expiry'
|
15
|
+
require 'cfnguardian/resources/dms_task'
|
16
|
+
require 'cfnguardian/resources/dms_cluster'
|
17
|
+
require 'cfnguardian/resources/documentdb_cluster'
|
15
18
|
require 'cfnguardian/resources/dynamodb_table'
|
16
19
|
require 'cfnguardian/resources/ec2_instance'
|
17
20
|
require 'cfnguardian/resources/ecs_cluster'
|
@@ -153,6 +153,38 @@ module CfnGuardian
|
|
153
153
|
@dimensions = { AutoScalingGroupName: resource['Id'] }
|
154
154
|
end
|
155
155
|
end
|
156
|
+
|
157
|
+
class DMSTaskAlarm < BaseAlarm
|
158
|
+
def initialize(resource)
|
159
|
+
super(resource)
|
160
|
+
@group = 'DMSTask'
|
161
|
+
@namespace = 'AWS/DMS'
|
162
|
+
@dimensions = {
|
163
|
+
ReplicationTaskIdentifier: resource['Id'],
|
164
|
+
ReplicationInstanceIdentifier: resource['Instance']
|
165
|
+
}
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class DMSClusterAlarm < BaseAlarm
|
170
|
+
def initialize(resource)
|
171
|
+
super(resource)
|
172
|
+
@group = 'DMSCluster'
|
173
|
+
@namespace = 'AWS/DMS'
|
174
|
+
@dimensions = {
|
175
|
+
ReplicationInstanceIdentifier: resource['Id']
|
176
|
+
}
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
class DocumentDBClusterAlarm < BaseAlarm
|
181
|
+
def initialize(resource)
|
182
|
+
super(resource)
|
183
|
+
@group = 'DocumentDBCluster'
|
184
|
+
@namespace = 'AWS/DocDB'
|
185
|
+
@dimensions = { DBClusterIdentifier: resource['Id'] }
|
186
|
+
end
|
187
|
+
end
|
156
188
|
|
157
189
|
class DomainExpiryAlarm < BaseAlarm
|
158
190
|
def initialize(resource)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class DMSCluster < Base
|
3
|
+
|
4
|
+
def default_alarms
|
5
|
+
alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
|
6
|
+
alarm.name = 'CPUUtilizationHighSpike'
|
7
|
+
alarm.metric_name = 'CPUUtilization'
|
8
|
+
alarm.threshold = 90
|
9
|
+
alarm.statistic = 'Minimum'
|
10
|
+
alarm.evaluation_periods = 10
|
11
|
+
@alarms.push(alarm)
|
12
|
+
|
13
|
+
alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
|
14
|
+
alarm.name = 'CPUUtilizationHighBase'
|
15
|
+
alarm.metric_name = 'CPUUtilization'
|
16
|
+
alarm.threshold = 95
|
17
|
+
alarm.evaluation_periods = 2
|
18
|
+
alarm.statistic = 'Maximum'
|
19
|
+
alarm.alarm_action = 'Warning'
|
20
|
+
@alarms.push(alarm)
|
21
|
+
|
22
|
+
alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
|
23
|
+
alarm.name = 'FreeStorageSpaceCrit'
|
24
|
+
alarm.metric_name = 'FreeStorageSpace'
|
25
|
+
alarm.statistic = 'Minimum'
|
26
|
+
alarm.threshold = 10000000000
|
27
|
+
alarm.evaluation_periods = 1
|
28
|
+
@alarms.push(alarm)
|
29
|
+
|
30
|
+
alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
|
31
|
+
alarm.name = 'FreeStorageSpaceWarn'
|
32
|
+
alarm.metric_name = 'FreeStorageSpace'
|
33
|
+
alarm.statistic = 'Minimum'
|
34
|
+
alarm.threshold = 20000000000
|
35
|
+
alarm.evaluation_periods = 1
|
36
|
+
alarm.alarm_action = 'Warning'
|
37
|
+
@alarms.push(alarm)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class DMSTask < Base
|
3
|
+
|
4
|
+
def default_alarms
|
5
|
+
alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
|
6
|
+
alarm.name = 'CDCLatencySourceCritical'
|
7
|
+
alarm.metric_name = 'CDCLatencySource'
|
8
|
+
alarm.statistic = 'Minimum'
|
9
|
+
alarm.threshold = 30
|
10
|
+
alarm.evaluation_periods = 10
|
11
|
+
alarm.enabled = false
|
12
|
+
@alarms.push(alarm)
|
13
|
+
|
14
|
+
alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
|
15
|
+
alarm.name = 'CDCLatencySourceWarn'
|
16
|
+
alarm.metric_name = 'CDCLatencySource'
|
17
|
+
alarm.statistic = 'Minimum'
|
18
|
+
alarm.threshold = 30
|
19
|
+
alarm.evaluation_periods = 1
|
20
|
+
alarm.enabled = false
|
21
|
+
@alarms.push(alarm)
|
22
|
+
|
23
|
+
alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
|
24
|
+
alarm.name = 'CDCLatencyTargetCritical'
|
25
|
+
alarm.metric_name = 'CDCLatencyTarget'
|
26
|
+
alarm.statistic = 'Minimum'
|
27
|
+
alarm.threshold = 30
|
28
|
+
alarm.evaluation_periods = 10
|
29
|
+
alarm.enabled = false
|
30
|
+
@alarms.push(alarm)
|
31
|
+
|
32
|
+
alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
|
33
|
+
alarm.name = 'CDCLatencyTargetWarn'
|
34
|
+
alarm.metric_name = 'CDCLatencyTarget'
|
35
|
+
alarm.statistic = 'Minimum'
|
36
|
+
alarm.threshold = 30
|
37
|
+
alarm.evaluation_periods = 1
|
38
|
+
alarm.enabled = false
|
39
|
+
@alarms.push(alarm)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module CfnGuardian::Resource
|
2
|
+
class DocumentDBCluster < Base
|
3
|
+
|
4
|
+
def default_alarms
|
5
|
+
alarm = CfnGuardian::Models::DocumentDBClusterAlarm.new(@resource)
|
6
|
+
alarm.name = 'CPUUtilizationHighBase'
|
7
|
+
alarm.metric_name = 'CPUUtilization'
|
8
|
+
alarm.threshold = 75
|
9
|
+
alarm.evaluation_periods = 60
|
10
|
+
alarm.alarm_action = 'Warning'
|
11
|
+
@alarms.push(alarm)
|
12
|
+
|
13
|
+
alarm = CfnGuardian::Models::DocumentDBClusterAlarm.new(@resource)
|
14
|
+
alarm.name = 'CPUUtilizationHighSpike'
|
15
|
+
alarm.metric_name = 'CPUUtilization'
|
16
|
+
alarm.threshold = 95
|
17
|
+
alarm.evaluation_periods = 10
|
18
|
+
@alarms.push(alarm)
|
19
|
+
|
20
|
+
alarm = CfnGuardian::Models::DocumentDBClusterAlarm.new(@resource)
|
21
|
+
alarm.name = 'DatabaseConnections'
|
22
|
+
alarm.metric_name = 'DatabaseConnections'
|
23
|
+
alarm.statistic = 'Minimum'
|
24
|
+
alarm.threshold = 50
|
25
|
+
alarm.evaluation_periods = 10
|
26
|
+
@alarms.push(alarm)
|
27
|
+
|
28
|
+
alarm = CfnGuardian::Models::DocumentDBClusterAlarm.new(@resource)
|
29
|
+
alarm.name = 'FreeableMemory'
|
30
|
+
alarm.metric_name = 'FreeableMemory'
|
31
|
+
alarm.threshold = 1000000000
|
32
|
+
alarm.evaluation_periods = 3
|
33
|
+
alarm.comparison_operator = 'LessThanThreshold'
|
34
|
+
@alarms.push(alarm)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
@@ -14,8 +14,9 @@ module CfnGuardian
|
|
14
14
|
alarm = CfnGuardian::Models::Ec2InstanceAlarm.new(@resource)
|
15
15
|
alarm.name = 'StatusCheckFailed'
|
16
16
|
alarm.metric_name = 'StatusCheckFailed'
|
17
|
-
alarm.threshold =
|
18
|
-
alarm.evaluation_periods =
|
17
|
+
alarm.threshold = 0
|
18
|
+
alarm.evaluation_periods = 1
|
19
|
+
alarm.comparison_operator = 'GreaterThanThreshold'
|
19
20
|
@alarms.push(alarm)
|
20
21
|
|
21
22
|
alarm = CfnGuardian::Models::Ec2InstanceAlarm.new(@resource)
|
data/lib/cfnguardian/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn-guardian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guslington
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -280,6 +280,9 @@ files:
|
|
280
280
|
- lib/cfnguardian/resources/base.rb
|
281
281
|
- lib/cfnguardian/resources/batch.rb
|
282
282
|
- lib/cfnguardian/resources/cloudfront_distribution.rb
|
283
|
+
- lib/cfnguardian/resources/dms_cluster.rb
|
284
|
+
- lib/cfnguardian/resources/dms_task.rb
|
285
|
+
- lib/cfnguardian/resources/documentdb_cluster.rb
|
283
286
|
- lib/cfnguardian/resources/domain_expiry.rb
|
284
287
|
- lib/cfnguardian/resources/dynamodb_table.rb
|
285
288
|
- lib/cfnguardian/resources/ec2_instance.rb
|