Module: Tapjoy::AutoscalingBootstrap::Cloudwatch
- Defined in:
- lib/tapjoy/autoscaling_bootstrap/cloudwatch.rb
Overview
This module configures cloudwatch alarms
Class Method Summary collapse
- .alarm_exists(alarm) ⇒ Object
-
.create_alarm(scale_alert) ⇒ Object
Create autoscaling alarms.
-
.delete_alarm(alarm) ⇒ Object
Delete autoscaling alarms.
Class Method Details
.alarm_exists(alarm) ⇒ Object
23 24 25 |
# File 'lib/tapjoy/autoscaling_bootstrap/cloudwatch.rb', line 23 def alarm_exists(alarm) Tapjoy::AutoscalingBootstrap::AWS::Cloudwatch.describe_alarm(alarm).length > 0 end |
.create_alarm(scale_alert) ⇒ Object
Create autoscaling alarms
7 8 9 10 11 |
# File 'lib/tapjoy/autoscaling_bootstrap/cloudwatch.rb', line 7 def create_alarm(scale_alert) puts "Creating: #{scale_alert[:alarm]}" Tapjoy::AutoscalingBootstrap::AWS::Cloudwatch.put_metric_alarm( **scale_alert) end |
.delete_alarm(alarm) ⇒ Object
Delete autoscaling alarms
14 15 16 17 18 19 20 21 |
# File 'lib/tapjoy/autoscaling_bootstrap/cloudwatch.rb', line 14 def delete_alarm(alarm) if self.alarm_exists(alarm) puts "Deleting alarm: #{alarm}" Tapjoy::AutoscalingBootstrap::AWS::Cloudwatch.delete_alarm(alarm) else STDERR.puts "'#{alarm}' doesn't exist. Skipping..." end end |