Skip to content

Instantly share code, notes, and snippets.

@l1x
Created May 7, 2013 17:19
Show Gist options
  • Save l1x/5534386 to your computer and use it in GitHub Desktop.
Save l1x/5534386 to your computer and use it in GitHub Desktop.
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',
:proxy_uri => 'https://127.0.0.1:1234'
})
cloudwatch_metric
end
def cloudwatch_metric
cw = AWS::CloudWatch.new(:region => 'us-west-2')
["AWS/EC2", "AWS/Billing", "AWS/DynamoDB", "AWS/EBS", "AWS/ElasticMapReduce", "AWS/RDS", "AWS/SNS", "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