Module: Cloudscopes
- Defined in:
- lib/cloudscopes.rb,
lib/cloudscopes/ec2.rb,
lib/cloudscopes/redis.rb,
lib/cloudscopes/memory.rb,
lib/cloudscopes/sample.rb,
lib/cloudscopes/system.rb,
lib/cloudscopes/network.rb,
lib/cloudscopes/options.rb,
lib/cloudscopes/process.rb,
lib/cloudscopes/version.rb,
lib/cloudscopes/filesystem.rb,
lib/cloudscopes/configuration.rb
Defined Under Namespace
Modules: StatFs
Classes: Ec2, Filesystem, Memory, Network, Options, Process, RedisClient, Sample, System
Constant Summary
collapse
- VERSION =
"0.13.0"
Class Method Summary
collapse
Class Method Details
.client ⇒ Object
18
19
20
|
# File 'lib/cloudscopes/configuration.rb', line 18
def client
@client ||= initClient
end
|
.data_dimensions ⇒ Object
28
29
30
|
# File 'lib/cloudscopes/configuration.rb', line 28
def data_dimensions
@settings['dimensions'] || ({ 'InstanceId' => '#{ec2.instance_id}' })
end
|
.get_binding ⇒ Object
24
25
26
|
# File 'lib/cloudscopes.rb', line 24
def self.get_binding
return binding()
end
|
.init ⇒ Object
4
5
6
7
8
9
10
11
12
|
# 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 ⇒ Object
22
23
24
25
26
|
# 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) ⇒ Object
28
29
30
|
# 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) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/cloudscopes/redis.rb', line 46
def self.redis(host = 'localhost', port = 6379)
begin
require 'redis'
RedisClient.new(host,port)
rescue LoadError
nil
end
end
|
.should_publish ⇒ Object
14
15
16
|
# File 'lib/cloudscopes/configuration.rb', line 14
def should_publish
@opts.publish
end
|
.system ⇒ Object
must define, otherwise kernel.system matches
44
45
46
|
# File 'lib/cloudscopes/system.rb', line 44
def self.system System.new
end
|