scout 5.7.5 → 5.8.0.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # 5.8.0.pre
2
+
3
+ Support for server metrics
4
+
1
5
  # 5.7.5
2
6
 
3
7
  * send unix timestamp when streaming data
data/Gemfile CHANGED
@@ -3,6 +3,8 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in scout.gemspec
4
4
  gemspec
5
5
 
6
+ gem "server_metrics"
7
+
6
8
  group :test do
7
9
  gem "newrelic_rpm"
8
10
  gem "activerecord", "2.2.2"
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby -wKU
2
+
3
+ require "rubygems" # only required during development, so server_metrics will load
4
+ require "server_metrics"
5
+
2
6
  require "scout/version"
3
7
 
4
8
  require "scout/http"
@@ -13,3 +17,4 @@ require "scout/daemon_spawn"
13
17
  require "scout/streamer_daemon"
14
18
  require "scout/data_file"
15
19
  require "scout/environment"
20
+
@@ -312,11 +312,37 @@ module Scout
312
312
  end
313
313
  end
314
314
  take_snapshot if @directives['take_snapshots']
315
+ get_server_metrics
315
316
  process_signature_errors
316
317
  store_account_public_key
317
318
  checkin
318
319
  end
319
-
320
+
321
+ # called from the main "run_plugin_by_plan" method.
322
+ def get_server_metrics
323
+ @history[:server_metrics] ||= {}
324
+
325
+ res={}
326
+ collectors = {:disk => ServerMetrics::Disk,
327
+ :cpu => ServerMetrics::Cpu,
328
+ :memory => ServerMetrics::Memory,
329
+ :network => ServerMetrics::Network,
330
+ :processes => ServerMetrics::Processes}
331
+
332
+ collectors.each_pair do |key,klass|
333
+ begin
334
+ collector_previous_run = @history[:server_metrics][key]
335
+ collector = collector_previous_run.is_a?(Hash) ? klass.from_hash(collector_previous_run) : klass.new() # continue with last run, or just create new
336
+ res[key] = collector.run
337
+ @history[:server_metrics][key] = collector.to_hash # store its state for next time
338
+ rescue Exception => e
339
+ raise if e.is_a?(SystemExit)
340
+ error "Problem running server/#{key} metrics: #{e.message}: \n#{e.backtrace.join("\n")}"
341
+ end
342
+ end
343
+ @checkin[:server_metrics] = res
344
+ end
345
+
320
346
  # Reports errors if there are any plugins with invalid signatures and sets a flag
321
347
  # to force a fresh plan on the next run.
322
348
  def process_signature_errors
@@ -502,7 +528,8 @@ module Scout
502
528
  :snapshot => '',
503
529
  :config_path => File.expand_path(File.dirname(@history_file)),
504
530
  :server_name => @server_name,
505
- :options => Array.new}
531
+ :options => Array.new,
532
+ :server_metrics => Hash.new }
506
533
  end
507
534
 
508
535
  def show_checkin(printer = :p)
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.7.5"
2
+ VERSION = "5.8.0.pre"
3
3
  end
@@ -24,4 +24,5 @@ END_DESC
24
24
  # specify any dependencies here; for example:
25
25
  # s.add_development_dependency "rspec"
26
26
  s.add_runtime_dependency "elif"
27
+ s.add_runtime_dependency "server_metrics",">= 0.0.3"
27
28
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.7.5
5
- prerelease:
4
+ version: 5.8.0.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andre Lewis
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-09-16 00:00:00.000000000 Z
14
+ date: 2013-11-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: elif
@@ -29,6 +29,22 @@ dependencies:
29
29
  - - ! '>='
30
30
  - !ruby/object:Gem::Version
31
31
  version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: server_metrics
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: 0.0.3
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.3
32
48
  description: ! 'The scout gem reports metrics to scoutapp.com, an easy-to-use hosted
33
49
  server monitoring service.
34
50
 
@@ -316,9 +332,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
316
332
  required_rubygems_version: !ruby/object:Gem::Requirement
317
333
  none: false
318
334
  requirements:
319
- - - ! '>='
335
+ - - ! '>'
320
336
  - !ruby/object:Gem::Version
321
- version: '0'
337
+ version: 1.3.1
322
338
  requirements: []
323
339
  rubyforge_project: scout
324
340
  rubygems_version: 1.8.25