Class: CfnGuardian::Resource::ECSService

Inherits:
Base
  • Object
show all
Defined in:
lib/cfnguardian/resources/ecs_service.rb

Instance Method Summary collapse

Methods inherited from Base

#default_checks, #default_event_subscriptions, #default_events, #default_metric_filters, #get_alarms, #get_checks, #get_cost, #get_event_subscriptions, #get_events, #get_metric_filters, #initialize, #resource_exists?

Methods included from Logging

colors, included, logger, #logger, logger=

Constructor Details

This class inherits a constructor from CfnGuardian::Resource::Base

Instance Method Details

#default_alarmsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/cfnguardian/resources/ecs_service.rb', line 5

def default_alarms    
  alarm = CfnGuardian::Models::ECSServiceAlarm.new(@resource)
  alarm.name = 'UnhealthyTaskCritical'
  alarm.metric_name = 'MemoryUtilization'
  alarm.comparison_operator = 'LessThanOrEqualToThreshold'
  alarm.statistic = 'SampleCount'
  alarm.threshold = 0
  alarm.evaluation_periods = 10
  alarm.datapoints_to_alarm = 8
  @alarms.push(alarm)
  
  alarm = CfnGuardian::Models::ECSServiceAlarm.new(@resource)
  alarm.name = 'UnhealthyTaskWarning'
  alarm.metric_name = 'MemoryUtilization'
  alarm.comparison_operator = 'LessThanOrEqualToThreshold'
  alarm.statistic = 'SampleCount'
  alarm.threshold = 1
  alarm.evaluation_periods = 10
  alarm.datapoints_to_alarm = 8
  alarm.alarm_action = 'Warning'
  @alarms.push(alarm)

  alarm = CfnGuardian::Models::ECSServiceAlarm.new(@resource)
  alarm.name = 'MemoryUtilizationCritical'
  alarm.metric_name = 'MemoryUtilization'
  alarm.comparison_operator = 'GreaterThanOrEqualToThreshold'
  alarm.statistic = 'Average'
  alarm.threshold = 90
  alarm.evaluation_periods = 5
  alarm.treat_missing_data = 'breaching'
  alarm.alarm_action = 'Critical'
  alarm.datapoints_to_alarm = 4
  alarm.treat_missing_data = 'notBreaching'
  alarm.enabled = false
  @alarms.push(alarm)
  
  alarm = CfnGuardian::Models::ECSServiceAlarm.new(@resource)
  alarm.name = 'MemoryUtilizationWarning'
  alarm.metric_name = 'MemoryUtilization'
  alarm.comparison_operator = 'GreaterThanOrEqualToThreshold'
  alarm.statistic = 'Average'
  alarm.threshold = 80
  alarm.evaluation_periods = 5
  alarm.treat_missing_data = 'breaching'
  alarm.datapoints_to_alarm = 4
  alarm.treat_missing_data = 'notBreaching'
  alarm.alarm_action = 'Warning'
  alarm.enabled = false
  @alarms.push(alarm)   

  alarm = CfnGuardian::Models::ECSServiceAlarm.new(@resource)
  alarm.name = 'CPUUtilizationCritical'
  alarm.metric_name = 'CPUUtilization'
  alarm.comparison_operator = 'GreaterThanOrEqualToThreshold'
  alarm.statistic = 'Average'
  alarm.threshold = 90
  alarm.evaluation_periods = 5
  alarm.treat_missing_data = 'breaching'
  alarm.alarm_action = 'Critical'
  alarm.datapoints_to_alarm = 4
  alarm.treat_missing_data = 'notBreaching'
  alarm.enabled = false
  @alarms.push(alarm)
  
  alarm = CfnGuardian::Models::ECSServiceAlarm.new(@resource)
  alarm.name = 'CPUUtilizationWarning'
  alarm.metric_name = 'CPUUtilization'
  alarm.comparison_operator = 'GreaterThanOrEqualToThreshold'
  alarm.statistic = 'Average'
  alarm.threshold = 80
  alarm.evaluation_periods = 5
  alarm.treat_missing_data = 'breaching'
  alarm.datapoints_to_alarm = 4
  alarm.treat_missing_data = 'notBreaching'
  alarm.alarm_action = 'Warning'
  alarm.enabled = false
  @alarms.push(alarm)      
end