module Ruboty::ElbMonitor

Constants

DEFAULT_METRICS
NAMESPACE
VERSION

Public Class Methods

cloudwatch(elb_name, start_time=nil, end_time=nil) click to toggle source
# File lib/ruboty/elb_monitor.rb, line 14
def cloudwatch(elb_name, start_time=nil, end_time=nil)
  options = sdk_options.merge(
    start_time: start_time,
    end_time:   end_time,
  )
  Aws::CloudWatch.new(elb_name, options)
end
elb(name) click to toggle source
# File lib/ruboty/elb_monitor.rb, line 10
def elb(name)
  Aws::Elb.new(name, sdk_options)
end
metrics() click to toggle source
# File lib/ruboty/elb_monitor.rb, line 22
def metrics
  (ENV["ELB_METRICS"] || DEFAULT_METRICS).split(/,/)
end
trend_separator() click to toggle source
# File lib/ruboty/elb_monitor.rb, line 26
def trend_separator
  ENV["ELB_TREND_SEPARATOR"] || ' '
end

Private Class Methods

sdk_options() click to toggle source
# File lib/ruboty/elb_monitor.rb, line 46
def sdk_options
  options = {
    http_proxy: ENV["HTTPS_PROXY"] || ENV["https_proxy"] || ENV["HTTP_PROXY"] || ENV["http_proxy"]
  }
  options[:region]            = ENV["ELB_REGION"]            if ENV["ELB_REGION"]
  options[:access_key_id]     = ENV["ELB_ACCESS_KEY_ID"]     if ENV["ELB_ACCESS_KEY_ID"]
  options[:secret_access_key] = ENV["ELB_SECRET_ACCESS_KEY"] if ENV["ELB_SECRET_ACCESS_KEY"]
  options
end