Module: Tapjoy::TassLib::AWS::Cloudwatch

Defined in:
lib/tapjoy/tass-lib/cloudwatch.rb

Overview

This class contains AWS methods for ELB

Class Method Summary collapse

Class Method Details

.clientObject



7
8
9
# File 'lib/tapjoy/tass-lib/cloudwatch.rb', line 7

def client
  @client ||= Aws::CloudWatch::Client.new
end

.delete_alarm(alarm) ⇒ Object



34
35
36
# File 'lib/tapjoy/tass-lib/cloudwatch.rb', line 34

def delete_alarm(alarm)
  self.client.delete_alarms(alarm_names: [alarm])
end

.describe_alarm(alarm) ⇒ Object



30
31
32
# File 'lib/tapjoy/tass-lib/cloudwatch.rb', line 30

def describe_alarm(alarm)
  self.client.describe_alarms(alarm_names: [alarm])[0]
end

.put_metric_alarm(alarm:, comparison_operator:, evaluation_periods:, threshold:, actions:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tapjoy/tass-lib/cloudwatch.rb', line 11

def put_metric_alarm(alarm:, comparison_operator:,
  evaluation_periods:, threshold:, actions:)
  self.client.put_metric_alarm(alarm_name: alarm,
    comparison_operator: comparison_operator,
    evaluation_periods: evaluation_periods,
    metric_name: 'CPUUtilization',
    namespace: 'AWS/EC2',
    period: 300,
    statistic: 'Average',
    threshold: threshold,
    alarm_actions: actions,
    dimensions: [
      {
        name:'AutoScalingGroupName',
        value: Tapjoy::TassLib.scaler_name
      }
    ])
end