Class: Tapjoy::AutoscalingBootstrap::Alerts::Monitoring

Inherits:
Object
  • Object
show all
Defined in:
lib/tapjoy/autoscaling_bootstrap/alerts/monitoring.rb

Overview

Class to handle monitoring alerts

Instance Method Summary collapse

Instance Method Details

#create(alarm_high_alert:, alarm_low_alert:, notification:) ⇒ Object

Create monitoring alerts



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
# File 'lib/tapjoy/autoscaling_bootstrap/alerts/monitoring.rb', line 7

def create(alarm_high_alert:, alarm_low_alert:, notification:)

  high_alert = {
    alarm:               alarm_high_alert,
    comparison_operator: 'GreaterThanOrEqualToThreshold',
    evaluation_periods:  1,
    threshold:           90,
    actions:             [notification]
  }

  low_alert = {
    alarm:               alarm_low_alert,
    comparison_operator: 'LessThanOrEqualToThreshold',
    evaluation_periods:  1,
    threshold:           35,
    actions:             [notification]
  }
  puts 'Clearing out original CloudWatch alarms'
  Tapjoy::AutoscalingBootstrap::Cloudwatch.delete_alarm(alarm_high_alert)
  Tapjoy::AutoscalingBootstrap::Cloudwatch.delete_alarm(alarm_low_alert)

  puts 'Creating new CloudWatch Alarms'
  Tapjoy::AutoscalingBootstrap::Cloudwatch.create_alarm(high_alert)
  puts "\n"

  Tapjoy::AutoscalingBootstrap::Cloudwatch.create_alarm(low_alert)
  puts "\n"
end