-
-
Save trotter/5534475 to your computer and use it in GitHub Desktop.
Using region as it works for me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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