Skip to content

Commit

Permalink
Merge pull request #56 from kyletbase2/master
Browse files Browse the repository at this point in the history
Added DMS task and cluster checks
  • Loading branch information
Guslington authored Feb 8, 2022
2 parents c89be40 + c730445 commit 5e25190
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ruby:2.7-alpine

ARG GUARDIAN_VERSION="0.7.7"
ARG GUARDIAN_VERSION="0.7.11"

COPY . /src

Expand Down
2 changes: 1 addition & 1 deletion docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
3. [Alarm Templates](alarm_templates.md)
4. Custom Checks
1. [HTTP](custom_checks/http.md)
2. [Domain Expirey](custom_checks/domain_expirey.md)
2. [Domain Expiry](custom_checks/domain_expiry.md)
3. [LogGroup Metric Filters](custom_checks/log_group_metric_filters.md)
4. [NRPE](custom_checks/nrpe.md)
5. [Port](custom_checks/port.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Resources:
| CloudFrontDistribution | Id |
| SQSQueue | Id |
| ElasticSearch | Id, Domain |
| DMSCluster | Id |
| DMSTask | Id, Instance |
## Custom Resource Groups
Expand Down
2 changes: 2 additions & 0 deletions lib/cfnguardian/compile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
require 'cfnguardian/resources/cloudfront_distribution'
require 'cfnguardian/resources/autoscaling_group'
require 'cfnguardian/resources/domain_expiry'
require 'cfnguardian/resources/dms_task'
require 'cfnguardian/resources/dms_cluster'
require 'cfnguardian/resources/documentdb_cluster'
require 'cfnguardian/resources/dynamodb_table'
require 'cfnguardian/resources/ec2_instance'
Expand Down
23 changes: 23 additions & 0 deletions lib/cfnguardian/models/alarm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,29 @@ def initialize(resource)
end
end

class DMSTaskAlarm < BaseAlarm
def initialize(resource)
super(resource)
@group = 'DMSTask'
@namespace = 'AWS/DMS'
@dimensions = {
ReplicationTaskIdentifier: resource['Id'],
ReplicationInstanceIdentifier: resource['Instance']
}
end
end

class DMSClusterAlarm < BaseAlarm
def initialize(resource)
super(resource)
@group = 'DMSCluster'
@namespace = 'AWS/DMS'
@dimensions = {
ReplicationInstanceIdentifier: resource['Id']
}
end
end

class DocumentDBClusterAlarm < BaseAlarm
def initialize(resource)
super(resource)
Expand Down
40 changes: 40 additions & 0 deletions lib/cfnguardian/resources/dms_cluster.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module CfnGuardian::Resource
class DMSCluster < Base

def default_alarms
alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
alarm.name = 'CPUUtilizationHighSpike'
alarm.metric_name = 'CPUUtilization'
alarm.threshold = 90
alarm.statistic = 'Minimum'
alarm.evaluation_periods = 10
@alarms.push(alarm)

alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
alarm.name = 'CPUUtilizationHighBase'
alarm.metric_name = 'CPUUtilization'
alarm.threshold = 95
alarm.evaluation_periods = 2
alarm.statistic = 'Maximum'
alarm.alarm_action = 'Warning'
@alarms.push(alarm)

alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
alarm.name = 'FreeStorageSpaceCrit'
alarm.metric_name = 'FreeStorageSpace'
alarm.statistic = 'Minimum'
alarm.threshold = 10000000000
alarm.evaluation_periods = 1
@alarms.push(alarm)

alarm = CfnGuardian::Models::DMSClusterAlarm.new(@resource)
alarm.name = 'FreeStorageSpaceWarn'
alarm.metric_name = 'FreeStorageSpace'
alarm.statistic = 'Minimum'
alarm.threshold = 20000000000
alarm.evaluation_periods = 1
alarm.alarm_action = 'Warning'
@alarms.push(alarm)
end
end
end
42 changes: 42 additions & 0 deletions lib/cfnguardian/resources/dms_task.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module CfnGuardian::Resource
class DMSTask < Base

def default_alarms
alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
alarm.name = 'CDCLatencySourceCritical'
alarm.metric_name = 'CDCLatencySource'
alarm.statistic = 'Minimum'
alarm.threshold = 30
alarm.evaluation_periods = 10
alarm.enabled = false
@alarms.push(alarm)

alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
alarm.name = 'CDCLatencySourceWarn'
alarm.metric_name = 'CDCLatencySource'
alarm.statistic = 'Minimum'
alarm.threshold = 30
alarm.evaluation_periods = 1
alarm.enabled = false
@alarms.push(alarm)

alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
alarm.name = 'CDCLatencyTargetCritical'
alarm.metric_name = 'CDCLatencyTarget'
alarm.statistic = 'Minimum'
alarm.threshold = 30
alarm.evaluation_periods = 10
alarm.enabled = false
@alarms.push(alarm)

alarm = CfnGuardian::Models::DMSTaskAlarm.new(@resource)
alarm.name = 'CDCLatencyTargetWarn'
alarm.metric_name = 'CDCLatencyTarget'
alarm.statistic = 'Minimum'
alarm.threshold = 30
alarm.evaluation_periods = 1
alarm.enabled = false
@alarms.push(alarm)
end
end
end

0 comments on commit 5e25190

Please sign in to comment.