scout_api 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
1
  == 0.9.0
2
2
 
3
- Initial release.
3
+ Initial release.
4
+
5
+ == 0.9.1
6
+
7
+ * Fixed Ruby 1.9.2 issue accessing Server#key
8
+ * Documentation updates
data/README.rdoc CHANGED
@@ -45,15 +45,16 @@ a group of metrics, and aggregated metrics. For example:
45
45
  Scout::Metric.average(1)
46
46
 
47
47
  # maximum rate of insert queries over the previous 24 hours
48
- Scout::Server.first(:name => "DB Server").metrics.maximum('inserts',:start => Time.now.utc-(24*3600)*2,:end => Time.now.utc-(24*3600))
48
+ Scout::Server.first(:name => "DB Server").metrics.maximum(:name => 'inserts',
49
+ :start => Time.now.utc-(24*3600)*2,:end => Time.now.utc-(24*3600) )
49
50
 
50
51
  # average memory used across all servers in the 'web servers' group
51
- Scout::Group.first(:name => 'web servers').metrics.average('mem_used')
52
- Scout::Group.first(:name => 'web servers').metrics.average('mem_used', :format => 'sparkline').to_sparkline
53
- Scout::Group.first(:name => 'web servers').metrics.average('mem_used').to_a
52
+ Scout::Group.first(:name => 'web servers').metrics.average(:name => 'Memory Used')
53
+ Scout::Group.first(:name => 'web servers').metrics.average(:name => 'Memory Used').to_sparkline
54
+ Scout::Group.first(:name => 'web servers').metrics.average(:name => 'Memory Used').to_a
54
55
 
55
56
  # total throughput across web servers
56
- Scout::Group.first(:name => 'web servers').metrics.average('request_rate', :aggregate => true)
57
+ Scout::Group.first(:name => 'web servers').metrics.average(:name => 'request_rate', :aggregate => true)
57
58
 
58
59
  == Server Management
59
60
 
@@ -19,15 +19,6 @@ class Scout::Account
19
19
  response['alerts'] ? response['alerts'].map { |alert| Scout::Alert.new(alert) } : Array.new
20
20
  end
21
21
 
22
- # All servers on this account
23
- #
24
- # @return [Array] An array of Scout::Server objects
25
- def servers
26
- warn "Scout#servers is deprecated. Use Scout::Server.all() instead."
27
- response = self.class.get("/clients.xml")
28
- response['clients'] ? response['clients'].map { |client| Scout::Server.new(client) } : Array.new
29
- end
30
-
31
22
  def people
32
23
  response = self.class.get("/account_memberships")
33
24
  doc = Nokogiri::HTML(response.body)
@@ -7,14 +7,14 @@ class Scout::Group < Hashie::Mash
7
7
  # Examples:
8
8
  #
9
9
  # * <tt>Scout::Group.metrics => All metrics associated with this group.</tt>
10
- # * <tt>Scout::Group.metrics.all(:name => 'mem_used') => Metrics with name =~ 'mem_used' across all servers in this group.</tt>
11
- # * <tt>Scout::Group.metrics.average(:name => 'mem_used') => Average value of metrics with name =~ 'mem_used' across all servers in the group.</tt>
12
- # * <tt>Scout::Group.metrics.maximum(:name => 'mem_used')</tt>
13
- # * <tt>Scout::Group.metrics.minimum(:name => 'mem_used')</tt>
10
+ # * <tt>Scout::Group.metrics.all(:name => 'Memory Used') => Metrics with name =~ 'Memory Used' across all servers in this group.</tt>
11
+ # * <tt>Scout::Group.metrics.average(:name => 'Memory Used') => Average value of metrics with name =~ 'Memory Used' across all servers in the group.</tt>
12
+ # * <tt>Scout::Group.metrics.maximum(:name => 'Memory Used')</tt>
13
+ # * <tt>Scout::Group.metrics.minimum(:name => 'Memory Used')</tt>
14
14
  # * <tt>Scout::Group.metrics.average(:name => 'request_rate', :aggregate => true) => Sum metrics, then take average</tt>
15
15
  # * <tt>Scout::Group.metrics.average(:name => 'request_rate', :start => Time.now.utc-5*3600, :end => Time.now.utc-2*3600) => Retrieve data starting @ 5 hours ago ending at 2 hours ago</tt>
16
- # * <tt>Scout::Group.metrics.average(:name => 'mem_used').to_array => An array of time series values over the past hour.</tt>
17
- # * <tt>Scout::Group.metrics.average(:name => 'mem_used').to_sparkline => A Url to a Google Sparkline Chart.</tt>
16
+ # * <tt>Scout::Group.metrics.average(:name => 'Memory Used').to_array => An array of time series values over the past hour.</tt>
17
+ # * <tt>Scout::Group.metrics.average(:name => 'Memory Used').to_sparkline => A Url to a Google Sparkline Chart.</tt>
18
18
  attr_reader :metrics
19
19
 
20
20
  def initialize(hash) #:nodoc:
@@ -86,7 +86,7 @@ class Scout::Metric < Hashie::Mash
86
86
  # Scout::Metric.average('request_rate', :aggregate => true)
87
87
  #
88
88
  # # How much average memory did my servers use yesterday?
89
- # # Scout::Metric.average('mem_used', :start => Time.now-(24*60*60)*2, :end => Time.now-(24*60*60))
89
+ # # Scout::Metric.average('Memory Used', :start => Time.now-(24*60*60)*2, :end => Time.now-(24*60*60))
90
90
  #
91
91
  # @return [Hash]
92
92
  def self.average(id_or_name,options = {})
@@ -7,14 +7,14 @@ class Scout::Plugin < Hashie::Mash
7
7
  # Examples:
8
8
  #
9
9
  # * <tt>Scout::Plugin.metrics => All metrics associated with this plugin.</tt>
10
- # * <tt>Scout::Plugin.metrics.all(:name => 'mem_used') => Metrics with name =~ 'mem_used' on this plugin.</tt>
11
- # * <tt>Scout::Plugin.metrics.average(:name => 'mem_used') => Average value of metrics with name =~ 'mem_used' on this plugin.</tt>
12
- # * <tt>Scout::Plugin.metrics.maximum(:name => 'mem_used')</tt>
13
- # * <tt>Scout::Plugin.metrics.minimum(:name => 'mem_used')</tt>
10
+ # * <tt>Scout::Plugin.metrics.all(:name => 'Memory Used') => Metrics with name =~ 'Memory Used' on this plugin.</tt>
11
+ # * <tt>Scout::Plugin.metrics.average(:name => 'Memory Used') => Average value of metrics with name =~ 'Memory Used' on this plugin.</tt>
12
+ # * <tt>Scout::Plugin.metrics.maximum(:name => 'Memory Used')</tt>
13
+ # * <tt>Scout::Plugin.metrics.minimum(:name => 'Memory Used')</tt>
14
14
  # * <tt>Scout::Plugin.metrics.average(:name => 'request_rate', :aggregate => true) => Sum metrics, then take average</tt>
15
15
  # * <tt>Scout::Plugin.metrics.average(:name => 'request_rate', :start => Time.now.utc-5*3600, :end => Time.now.utc-2*3600) => Retrieve data starting @ 5 hours ago ending at 2 hours ago</tt>
16
- # * <tt>Scout::Plugin.metrics.average(:name => 'mem_used').to_array => An array of time series values over the past hour.</tt>
17
- # * <tt>Scout::Plugin.metrics.average(:name => 'mem_used').to_sparkline => A Url to a Google Sparkline Chart.</tt>
16
+ # * <tt>Scout::Plugin.metrics.average(:name => 'Memory Used').to_array => An array of time series values over the past hour.</tt>
17
+ # * <tt>Scout::Plugin.metrics.average(:name => 'Memory Used').to_sparkline => A Url to a Google Sparkline Chart.</tt>
18
18
  attr_reader :metrics
19
19
 
20
20
  attr_reader :descriptor_hash #:nodoc:
@@ -5,14 +5,14 @@ class Scout::Server < Hashie::Mash
5
5
  # Examples:
6
6
  #
7
7
  # * <tt>Scout::Server.metrics => All metrics associated with this server.</tt>
8
- # * <tt>Scout::Server.metrics.all(:name => 'mem_used') => Metrics with name =~ 'mem_used' on this server.</tt>
9
- # * <tt>Scout::Server.metrics.average(:name => 'mem_used') => Average value of metrics with name =~ 'mem_used' on this server.</tt>
10
- # * <tt>Scout::Server.metrics.maximum(:name => 'mem_used')</tt>
11
- # * <tt>Scout::Server.metrics.minimum(:name => 'mem_used')</tt>
8
+ # * <tt>Scout::Server.metrics.all(:name => 'Memory Used') => Metrics with name =~ 'Memory Used' on this server.</tt>
9
+ # * <tt>Scout::Server.metrics.average(:name => 'Memory Used') => Average value of metrics with name =~ 'Memory Used' on this server.</tt>
10
+ # * <tt>Scout::Server.metrics.maximum(:name => 'Memory Used')</tt>
11
+ # * <tt>Scout::Server.metrics.minimum(:name => 'Memory Used')</tt>
12
12
  # * <tt>Scout::Server.metrics.average(:name => 'request_rate', :aggregate => true) => Sum metrics, then take average</tt>
13
13
  # * <tt>Scout::Server.metrics.average(:name => 'request_rate', :start => Time.now.utc-5*3600, :end => Time.now.utc-2*3600) => Retrieve data starting @ 5 hours ago ending at 2 hours ago</tt>
14
- # * <tt>Scout::Server.metrics.average(:name => 'mem_used').to_array => An array of time series values over the past hour.</tt>
15
- # * <tt>Scout::Server.metrics.average(:name => 'mem_used').to_sparkline => A Url to a Google Sparkline Chart.</tt>
14
+ # * <tt>Scout::Server.metrics.average(:name => 'Memory Used').to_array => An array of time series values over the past hour.</tt>
15
+ # * <tt>Scout::Server.metrics.average(:name => 'Memory Used').to_sparkline => A Url to a Google Sparkline Chart.</tt>
16
16
  attr_reader :metrics
17
17
 
18
18
  def initialize(hash) #:nodoc:
@@ -23,6 +23,11 @@ class Scout::Server < Hashie::Mash
23
23
  @metrics = Scout::MetricProxy.new(self)
24
24
  super(hash)
25
25
  end
26
+
27
+ # Ruby 1.9.2 Hash#key is a method. This overrides so +key+ returns Server#key.
28
+ def key #:nodoc:
29
+ self[:key]
30
+ end
26
31
 
27
32
  # Finds the first server that meets the given conditions. Possible parameter formats:
28
33
  #
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
data/scout_api.gemspec ADDED
@@ -0,0 +1,95 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{scout_api}
8
+ s.version = "0.9.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jesse Newland", "Derek Haynes"]
12
+ s.date = %q{2011-05-04}
13
+ s.description = %q{A library for interacting with Scout (http://scoutapp.com), a hosted server monitoring service. Query for metric data, manage servers, and more.}
14
+ s.email = %q{support@scoutapp.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "CHANGELOG",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "lib/scout_api.rb",
28
+ "lib/scout_api/account.rb",
29
+ "lib/scout_api/alert.rb",
30
+ "lib/scout_api/group.rb",
31
+ "lib/scout_api/metric.rb",
32
+ "lib/scout_api/metric_calculation.rb",
33
+ "lib/scout_api/metric_proxy.rb",
34
+ "lib/scout_api/person.rb",
35
+ "lib/scout_api/plugin.rb",
36
+ "lib/scout_api/server.rb",
37
+ "lib/scout_api/trigger.rb",
38
+ "lib/scout_api/version.rb",
39
+ "scout_api.gemspec",
40
+ "test/alert_test.rb",
41
+ "test/fixtures/activities.xml",
42
+ "test/fixtures/client.xml",
43
+ "test/fixtures/client_by_hostname.xml",
44
+ "test/fixtures/clients.xml",
45
+ "test/fixtures/data.xml",
46
+ "test/fixtures/descriptors.xml",
47
+ "test/fixtures/plugin_data.xml",
48
+ "test/fixtures/plugins.xml",
49
+ "test/fixtures/triggers.xml",
50
+ "test/global_test.rb",
51
+ "test/metric_proxy_test.rb",
52
+ "test/metric_test.rb",
53
+ "test/plugin_test.rb",
54
+ "test/server_test.rb",
55
+ "test/test_helper.rb"
56
+ ]
57
+ s.homepage = %q{https://scoutapp.com/info/api}
58
+ s.require_paths = ["lib"]
59
+ s.rubygems_version = %q{1.4.2}
60
+ s.summary = %q{API wrapper for scoutapp.com}
61
+ s.test_files = [
62
+ "test/alert_test.rb",
63
+ "test/global_test.rb",
64
+ "test/metric_proxy_test.rb",
65
+ "test/metric_test.rb",
66
+ "test/plugin_test.rb",
67
+ "test/server_test.rb",
68
+ "test/test_helper.rb"
69
+ ]
70
+
71
+ if s.respond_to? :specification_version then
72
+ s.specification_version = 3
73
+
74
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
75
+ s.add_runtime_dependency(%q<hashie>, ["~> 0.1.8"])
76
+ s.add_runtime_dependency(%q<httparty>, ["~> 0.5.0"])
77
+ s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
78
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
79
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.0"])
80
+ else
81
+ s.add_dependency(%q<hashie>, ["~> 0.1.8"])
82
+ s.add_dependency(%q<httparty>, ["~> 0.5.0"])
83
+ s.add_dependency(%q<nokogiri>, [">= 0"])
84
+ s.add_dependency(%q<fakeweb>, [">= 0"])
85
+ s.add_dependency(%q<jeweler>, ["~> 1.5.0"])
86
+ end
87
+ else
88
+ s.add_dependency(%q<hashie>, ["~> 0.1.8"])
89
+ s.add_dependency(%q<httparty>, ["~> 0.5.0"])
90
+ s.add_dependency(%q<nokogiri>, [">= 0"])
91
+ s.add_dependency(%q<fakeweb>, [">= 0"])
92
+ s.add_dependency(%q<jeweler>, ["~> 1.5.0"])
93
+ end
94
+ end
95
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0
10
- version: 0.9.0
9
+ - 1
10
+ version: 0.9.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jesse Newland
@@ -124,7 +124,7 @@ files:
124
124
  - lib/scout_api/server.rb
125
125
  - lib/scout_api/trigger.rb
126
126
  - lib/scout_api/version.rb
127
- - scout_scout.gemspec
127
+ - scout_api.gemspec
128
128
  - test/alert_test.rb
129
129
  - test/fixtures/activities.xml
130
130
  - test/fixtures/client.xml
data/scout_scout.gemspec DELETED
@@ -1,86 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{scout_scout}
8
- s.version = "0.0.6"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jesse Newland"]
12
- s.date = %q{2011-04-10}
13
- s.description = %q{API wrapper for scout.com}
14
- s.email = %q{jnewland@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "lib/scout_scout.rb",
27
- "lib/scout_scout/alert.rb",
28
- "lib/scout_scout/cluster.rb",
29
- "lib/scout_scout/descriptor.rb",
30
- "lib/scout_scout/metric.rb",
31
- "lib/scout_scout/person.rb",
32
- "lib/scout_scout/plugin.rb",
33
- "lib/scout_scout/server.rb",
34
- "lib/scout_scout/trigger.rb",
35
- "lib/scout_scout/version.rb",
36
- "scout_scout.gemspec",
37
- "spec/fixtures/activities.xml",
38
- "spec/fixtures/client.xml",
39
- "spec/fixtures/client_by_hostname.xml",
40
- "spec/fixtures/clients.xml",
41
- "spec/fixtures/data.xml",
42
- "spec/fixtures/descriptors.xml",
43
- "spec/fixtures/plugin_data.xml",
44
- "spec/fixtures/plugins.xml",
45
- "spec/fixtures/triggers.xml",
46
- "spec/scout_scout_spec.rb",
47
- "spec/spec.opts",
48
- "spec/spec_helper.rb"
49
- ]
50
- s.homepage = %q{http://github.com/jnewland/scout_scout}
51
- s.require_paths = ["lib"]
52
- s.rubygems_version = %q{1.4.2}
53
- s.summary = %q{API wrapper for scout.com}
54
- s.test_files = [
55
- "spec/scout_scout_spec.rb",
56
- "spec/spec_helper.rb"
57
- ]
58
-
59
- if s.respond_to? :specification_version then
60
- s.specification_version = 3
61
-
62
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
- s.add_runtime_dependency(%q<hashie>, ["~> 0.1.8"])
64
- s.add_runtime_dependency(%q<httparty>, ["~> 0.5.0"])
65
- s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
66
- s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
67
- s.add_development_dependency(%q<fakeweb>, [">= 0"])
68
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.0"])
69
- else
70
- s.add_dependency(%q<hashie>, ["~> 0.1.8"])
71
- s.add_dependency(%q<httparty>, ["~> 0.5.0"])
72
- s.add_dependency(%q<nokogiri>, [">= 0"])
73
- s.add_dependency(%q<rspec>, ["~> 1.3.0"])
74
- s.add_dependency(%q<fakeweb>, [">= 0"])
75
- s.add_dependency(%q<jeweler>, ["~> 1.5.0"])
76
- end
77
- else
78
- s.add_dependency(%q<hashie>, ["~> 0.1.8"])
79
- s.add_dependency(%q<httparty>, ["~> 0.5.0"])
80
- s.add_dependency(%q<nokogiri>, [">= 0"])
81
- s.add_dependency(%q<rspec>, ["~> 1.3.0"])
82
- s.add_dependency(%q<fakeweb>, [">= 0"])
83
- s.add_dependency(%q<jeweler>, ["~> 1.5.0"])
84
- end
85
- end
86
-