scout 5.8.7.pre → 5.8.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,6 +1,6 @@
1
1
  # 5.8.7
2
2
 
3
- * Added support for realtime system metrics (processes, cpu, memory, disks, network devices)
3
+ * Upgrade to use server_metrics 1.2.2 (disk metrics in English, more forgiving Linux check)
4
4
 
5
5
  # 5.8.6
6
6
 
@@ -9,7 +9,7 @@ module Scout
9
9
 
10
10
  # * history_file is the *path* to the history file
11
11
  # * plugin_ids is an array of integers
12
- def initialize(history_file, streaming_key, p_app_id, p_key, p_secret, plugin_ids, system_metric_collectors, hostname, http_proxy, logger = nil)
12
+ def initialize(history_file, streaming_key, p_app_id, p_key, p_secret, plugin_ids, hostname, http_proxy, logger = nil)
13
13
  @@continue_streaming = true
14
14
  @history_file = history_file
15
15
  @history = Hash.new
@@ -71,32 +71,11 @@ module Scout
71
71
  :class=>plugin_hash['code_class']}
72
72
  end
73
73
 
74
- system_metric_data = {}
75
- all_collectors = {:disk => ServerMetrics::Disk,
76
- :cpu => ServerMetrics::Cpu,
77
- :memory => ServerMetrics::Memory,
78
- :network => ServerMetrics::Network,
79
- :processes => ServerMetrics::Processes}
80
-
81
- realtime_collectors = all_collectors.select { |key, klass| system_metric_collectors.include?(key) }
82
- realtime_collectors.each_pair do |key, klass|
83
- begin
84
- collector_previous_run = @history[:server_metrics][key]
85
- collector = collector_previous_run.is_a?(Hash) ? klass.from_hash(collector_previous_run) : klass.new() # continue with last run, or just create new
86
- system_metric_data[key] = collector.run
87
- @history[:server_metrics][key] = collector.to_hash # store its state for next time
88
- rescue Exception => e
89
- raise if e.is_a?(SystemExit)
90
- error "Problem running server/#{key} metrics: #{e.message}: \n#{e.backtrace.join("\n")}"
91
- end
92
- end
93
-
94
74
  bundle={:hostname=>hostname,
95
75
  :server_time=>Time.now.strftime("%I:%M:%S %p"),
96
76
  :server_unixtime => Time.now.to_i,
97
77
  :num_processes=>`ps -e | wc -l`.chomp.to_i,
98
- :plugins=>plugins,
99
- :system_metrics => system_metric_data}
78
+ :plugins=>plugins }
100
79
 
101
80
  # stream the data via pusherapp
102
81
  begin
@@ -220,4 +199,4 @@ module Scout
220
199
  end
221
200
 
222
201
  end
223
- end
202
+ end
@@ -11,19 +11,17 @@ module Scout
11
11
  :sync_log => true,
12
12
  :working_dir => File.dirname(history_file)}
13
13
 
14
- # streamer command might look like: start,A0000000000123,a,b,c,1,3,cpu,memory
14
+ # streamer command might look like: start,A0000000000123,a,b,c,1,3
15
15
  tokens = streamer_command.split(",")
16
16
  tokens.shift # gets rid of the "start"
17
17
  streaming_key = tokens.shift
18
18
  p_app_id = tokens.shift
19
19
  p_key = tokens.shift
20
20
  p_secret = tokens.shift
21
- numerical_tokens = tokens.select { |token| token =~ /\A\d+\Z/ }
22
- system_metric_collectors = (tokens - numerical_tokens).map(&:to_sym)
23
- plugin_ids = numerical_tokens.map(&:to_i)
21
+ plugin_ids = tokens.map(&:to_i)
24
22
 
25
23
  # we use STDOUT for the logger because daemon_spawn directs STDOUT to a log file
26
- streamer_args = [history_file,streaming_key,p_app_id,p_key,p_secret,plugin_ids,system_metric_collectors,hostname,http_proxy,Logger.new(STDOUT)]
24
+ streamer_args = [history_file,streaming_key,p_app_id,p_key,p_secret,plugin_ids,hostname,http_proxy,Logger.new(STDOUT)]
27
25
  if File.exists?(streamer_pid_file)
28
26
  Scout::StreamerDaemon.restart(daemon_spawn_options, streamer_args)
29
27
  else
@@ -47,8 +45,8 @@ module Scout
47
45
 
48
46
  # this method is called by DaemonSpawn's class start method.
49
47
  def start(streamer_args)
50
- history,streaming_key,p_app_id,p_key,p_secret,plugin_ids,system_metric_collectors,hostname,http_proxy,log = streamer_args
51
- @scout = Scout::Streamer.new(history, streaming_key, p_app_id, p_key, p_secret, plugin_ids, system_metric_collectors, hostname, http_proxy, log)
48
+ history,streaming_key,p_app_id,p_key,p_secret,plugin_ids,hostname,http_proxy,log = streamer_args
49
+ @scout = Scout::Streamer.new(history, streaming_key, p_app_id, p_key, p_secret, plugin_ids, hostname, http_proxy, log)
52
50
  end
53
51
 
54
52
  # this method is called by DaemonSpawn's class stop method.
data/lib/scout/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.8.7.pre"
2
+ VERSION = "5.8.7"
3
3
  end
data/scout.gemspec CHANGED
@@ -24,5 +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",">= 1.2.0"
27
+ s.add_runtime_dependency "server_metrics",">= 1.2.2"
28
28
  end
metadata CHANGED
@@ -1,53 +1,66 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: scout
3
- version: !ruby/object:Gem::Version
4
- version: 5.8.7.pre
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 5
8
+ - 8
9
+ - 7
10
+ version: 5.8.7
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Andre Lewis
8
14
  - Derek Haynes
9
15
  - James Edward Gray II
10
16
  autorequire:
11
17
  bindir: bin
12
18
  cert_chain: []
13
- date: 2014-03-06 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
19
+
20
+ date: 2014-03-12 00:00:00 -06:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
16
24
  name: elif
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
25
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - '>='
27
- - !ruby/object:Gem::Version
28
- version: '0'
29
- - !ruby/object:Gem::Dependency
30
- name: server_metrics
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - '>='
34
- - !ruby/object:Gem::Version
35
- version: 1.2.0
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
36
35
  type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: server_metrics
37
39
  prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - '>='
41
- - !ruby/object:Gem::Version
42
- version: 1.2.0
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 1
48
+ - 2
49
+ - 2
50
+ version: 1.2.2
51
+ type: :runtime
52
+ version_requirements: *id002
43
53
  description: |
44
54
  The scout gem reports metrics to scoutapp.com, an easy-to-use hosted server monitoring service.
55
+
45
56
  email: support@scoutapp.com
46
- executables:
57
+ executables:
47
58
  - scout
48
59
  extensions: []
60
+
49
61
  extra_rdoc_files: []
50
- files:
62
+
63
+ files:
51
64
  - .gitignore
52
65
  - CHANGELOG.markdown
53
66
  - Gemfile
@@ -81,7 +94,6 @@ files:
81
94
  - scout.gemspec
82
95
  - test/plugins/disk_usage.rb
83
96
  - test/scout_test.rb
84
- - test/streamer_test.rb
85
97
  - vendor/httpclient/README.txt
86
98
  - vendor/httpclient/bin/httpclient
87
99
  - vendor/httpclient/lib/hexdump.rb
@@ -311,30 +323,40 @@ files:
311
323
  - vendor/signature/spec/signature_spec.rb
312
324
  - vendor/signature/spec/spec_helper.rb
313
325
  - vendor/util/lib/core_extensions.rb
326
+ has_rdoc: true
314
327
  homepage: http://scoutapp.com
315
328
  licenses: []
316
- metadata: {}
329
+
317
330
  post_install_message:
318
331
  rdoc_options: []
319
- require_paths:
332
+
333
+ require_paths:
320
334
  - lib
321
- required_ruby_version: !ruby/object:Gem::Requirement
322
- requirements:
323
- - - '>='
324
- - !ruby/object:Gem::Version
325
- version: '0'
326
- required_rubygems_version: !ruby/object:Gem::Requirement
327
- requirements:
328
- - - '>'
329
- - !ruby/object:Gem::Version
330
- version: 1.3.1
335
+ required_ruby_version: !ruby/object:Gem::Requirement
336
+ none: false
337
+ requirements:
338
+ - - ">="
339
+ - !ruby/object:Gem::Version
340
+ hash: 3
341
+ segments:
342
+ - 0
343
+ version: "0"
344
+ required_rubygems_version: !ruby/object:Gem::Requirement
345
+ none: false
346
+ requirements:
347
+ - - ">="
348
+ - !ruby/object:Gem::Version
349
+ hash: 3
350
+ segments:
351
+ - 0
352
+ version: "0"
331
353
  requirements: []
354
+
332
355
  rubyforge_project: scout
333
- rubygems_version: 2.1.9
356
+ rubygems_version: 1.4.2
334
357
  signing_key:
335
- specification_version: 4
336
- summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby
337
- gem reports metrics to our service. The agent runs plugins, configured via the Scout
338
- web interface, to monitor a server.
339
- test_files: []
340
- has_rdoc:
358
+ specification_version: 3
359
+ summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby gem reports metrics to our service. The agent runs plugins, configured via the Scout web interface, to monitor a server.
360
+ test_files:
361
+ - test/plugins/disk_usage.rb
362
+ - test/scout_test.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 2bd2faad548e9481be7072ef0d517fa34204eb5c
4
- data.tar.gz: edab687a4b73eaa562d900e6ba81b27859e40e3a
5
- SHA512:
6
- metadata.gz: ed2efa5769da4f8648138e236e8dead6f1f707a2a4743c35cb8f4cc094a885f5be1cc43808a727bbc5b191f28f0d505a57e553e7e154a8fc32cdd124b71a8fa2
7
- data.tar.gz: b90907cdbb9d16179fbb296e149f1a54a63260683de351bc047d23d092bd50bd2cad7b2d0dd16dd298fbba540ad2b9f8c79bd01fadc1d6c6c8700777d795e261
@@ -1,60 +0,0 @@
1
- require 'test/unit'
2
- begin
3
- require 'pry'
4
- rescue LoadError
5
- # not using pry
6
- end
7
- # must be loaded after
8
- $LOAD_PATH << File.expand_path( File.dirname(__FILE__) + '/../lib' )
9
- $LOAD_PATH << File.expand_path( File.dirname(__FILE__) + '/..' )
10
- require 'lib/scout'
11
- require 'mocha/setup'
12
-
13
- class StreamerTest < Test::Unit::TestCase
14
- def test_reports_system_metrics
15
- stub_history_file
16
- plugin_ids_stub = []
17
- system_metric_collectors = [:disk]
18
-
19
- mock_pusher do
20
- streamer = Scout::Streamer.new(:history_file_stub, :streaming_key_stub, :pusher_app_id_stub, :pusher_key_stub, :pusher_secret_stub, plugin_ids_stub, system_metric_collectors, :hostname_stub, :http_proxy_stub)
21
- end
22
-
23
- response = Pusher::Channel.streamer_data.first
24
- assert_equal [:disk], response[:system_metrics].keys
25
- end
26
-
27
- private
28
-
29
- def stub_history_file
30
- File.stubs(:read).with(:history_file_stub).returns(YAML.dump({:server_metrics => {}}))
31
- File.stubs(:dirname).with(:history_file_stub).returns('tmp')
32
- end
33
-
34
- # this with a block to mock the pusher call. You can access the streamer data through the Pusher::Channel.streamer_data
35
- # Must be called with a code block
36
- def mock_pusher(num_runs=1)
37
- # redefine the trigger! method, so the streamer doesn't loop indefinitely. We can't just mock it, because
38
- # we need to set the $continue_streaming=false
39
- $num_runs_for_mock_pusher=num_runs
40
- Pusher::Channel.module_eval do
41
- alias orig_trigger! trigger!
42
- def self.streamer_data;@@streamer_data;end # for getting the data back out
43
- def trigger!(event_name, data, socket=nil)
44
- $num_run_for_tests = $num_run_for_tests ? $num_run_for_tests+1 : 1
45
- @@streamer_data_temp ||= Array.new
46
- @@streamer_data_temp << data
47
- if $num_run_for_tests >= $num_runs_for_mock_pusher
48
- Scout::Streamer.continue_streaming=false
49
- $num_run_for_tests=nil
50
- @@streamer_data = @@streamer_data_temp.clone
51
- @@streamer_data_temp = nil
52
- end
53
- end
54
- end
55
- yield # must be called with a block
56
- Pusher::Channel.module_eval do
57
- alias trigger! orig_trigger!
58
- end
59
- end
60
- end