Skip to content

Instantly share code, notes, and snippets.

@trotter
Forked from l1x/cloudwatch_test.rb
Last active December 17, 2015 02:19
Show Gist options
  • Save trotter/5534475 to your computer and use it in GitHub Desktop.
Save trotter/5534475 to your computer and use it in GitHub Desktop.
Using region as it works for me.
require 'pp'
require 'aws-sdk'
require 'logger'
module RAWS
class Metrics
def initialize
config_path = '.riotaws.yml'
AWS.config({
:access_key_id => 'A...',
:secret_access_key => 'Xx...',
:logger => Logger.new(STDOUT),
:log_level => :debug,
:region => 'us-west-2'
#:endpoint => 'monitoring.us-west-2.amazonaws.com'
})
cloudwatch_metric
end
def cloudwatch_metric
cw = AWS::CloudWatch.new(:region => 'us-west-2')
["AWS/ELB"].each { |namespace|
pp "#{namespace} has #{cw.client.list_metrics({:namespace => namespace}).data[:metrics].length} of metrics"
puts "#{cw.client.list_metrics({:namespace => namespace}).data[:metrics].inspect}"
puts "#{cw.client.list_metrics({:namespace => namespace}).inspect}"
}
end
end
end
RAWS::Metrics.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment