module Cloudscopes

Constants

VERSION

Public Class Methods

client() click to toggle source
# File lib/cloudscopes/configuration.rb, line 18
def client
  @client ||= initClient
end
data_dimensions() click to toggle source
# File lib/cloudscopes/configuration.rb, line 28
def data_dimensions
  @settings['dimensions'] || ({ 'InstanceId' => '#{ec2.instance_id}' })
end
get_binding() click to toggle source
# File lib/cloudscopes.rb, line 24
def self.get_binding
  return binding()
end
init() click to toggle source
# File lib/cloudscopes/configuration.rb, line 4
def init
  @opts = Cloudscopes::Options.new
  configuration = {}
  (@opts.files.empty?? [ STDIN ] : @opts.files.collect { |fn| File.new(fn) }).each do |configfile|
    configuration.merge! YAML.load(configfile.read)
  end
  @settings = configuration['settings']
  configuration['metrics']
end
initClient() click to toggle source
# File lib/cloudscopes/configuration.rb, line 22
def initClient
  AWS::CloudWatch.new access_key_id: @settings['aws-key'],
                        secret_access_key: @settings['aws-secret'],
                        region: @settings['region']
end
method_missing(*args) click to toggle source
# File lib/cloudscopes.rb, line 28
def self.method_missing(*args)
  Cloudscopes.const_get(args.shift.to_s.capitalize).new(*args)
end
redis(host = 'localhost', port = 6379) click to toggle source
# File lib/cloudscopes/redis.rb, line 46
def self.redis(host = 'localhost', port = 6379)
  begin
    require 'redis'
    RedisClient.new(host,port)
  rescue LoadError
    # redis gem not installed
    nil
  end
end
should_publish() click to toggle source
# File lib/cloudscopes/configuration.rb, line 14
def should_publish
  @opts.publish
end
system() click to toggle source
# File lib/cloudscopes/system.rb, line 44
def self.system # must define, otherwise kernel.system matches
  System.new
end