Class: CfnGuardian::Resource::AutoScalingGroup

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

Instance Method Summary collapse

Methods inherited from Base

#default_checks, #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



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cfnguardian/resources/autoscaling_group.rb', line 4

def default_alarms    
  alarm = CfnGuardian::Models::AutoScalingGroupAlarm.new(@resource)
  alarm.name = 'CPUUtilizationHighBase'
  alarm.metric_name = 'CPUUtilization'
  alarm.statistic = 'Minimum'
  alarm.threshold = 90
  alarm.evaluation_periods = 10
  @alarms.push(alarm)
  
  alarm = CfnGuardian::Models::AutoScalingGroupAlarm.new(@resource)
  alarm.name = 'StatusCheckFailed'
  alarm.metric_name = 'StatusCheckFailed'
  alarm.threshold = 0
  alarm.evaluation_periods = 10
  @alarms.push(alarm)
end

#default_event_subscriptionsObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/cfnguardian/resources/autoscaling_group.rb', line 21

def default_event_subscriptions()
  event_subscription = CfnGuardian::Models::AutoScalingGroupEventSubscription.new(@resource)
  event_subscription.name = 'LaunchUnsuccessful'
  event_subscription.detail_type = 'EC2 Instance Launch Unsuccessful'
  event_subscription.detail = {
    'instance-id' => [@resource['Id']],
    'state' => ['terminated']
  }
  @event_subscriptions.push(event_subscription)
end