scout 5.4.6.alpha → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,6 +4,6 @@ pkg/*
4
4
  **/.DS_Store
5
5
  .idea
6
6
  working_dir/
7
- .bundle
8
7
  .rvmrc
9
8
  Gemfile.lock
9
+ .bundle
data/CHANGELOG CHANGED
@@ -1,3 +1,20 @@
1
+ == Master
2
+
3
+ == 5.5.0
4
+
5
+ * yes, the version number jumped from 5.3.5 to 5.5.0
6
+ * Implemented "real time" mode
7
+
8
+ == 5.3.5
9
+
10
+ * Moved proxy support to explicit command line flags --http_proxy and https_proxy
11
+ * fixed two unused variables that were causing warnings under 1.9.3
12
+
13
+ == 5.3.4
14
+
15
+ * Incorporating sleep interval into Server#time_to_checkin?
16
+ * Added proxy support command line flags
17
+
1
18
  == 5.3.3
2
19
 
3
20
  * Sending embedded options to server for local & plugin overrides.
data/bin/scout CHANGED
@@ -5,7 +5,6 @@ $VERBOSE = true # -w
5
5
  #$KCODE = "u" # -Ku
6
6
 
7
7
  $LOAD_PATH << File.join(File.dirname(__FILE__), *%w[.. lib])
8
-
9
8
  require "scout"
10
9
 
11
10
  Scout::Command.dispatch(ARGV)
@@ -9,4 +9,4 @@ require "scout/server_base"
9
9
  require "scout/server"
10
10
  require "scout/streamer"
11
11
  require "scout/daemon_spawn"
12
- require "scout/streamer_control"
12
+ require "scout/streamer_daemon"
@@ -72,6 +72,16 @@ module Scout
72
72
  options[:server_name] = server_name
73
73
  end
74
74
 
75
+ opts.on("--http-proxy URL", String,
76
+ "Optional http proxy for non-SSL traffic." ) do |http_proxy|
77
+ options[:http_proxy] = http_proxy
78
+ end
79
+
80
+ opts.on("--https-proxy URL", String,
81
+ "Optional https proxy for SSL traffic." ) do |https_proxy|
82
+ options[:https_proxy] = https_proxy
83
+ end
84
+
75
85
  opts.separator " "
76
86
  opts.separator "Common Options:"
77
87
  opts.separator "--------------------------------------------------------------------------"
@@ -95,16 +105,6 @@ module Scout
95
105
  options[:force] = bool
96
106
  end
97
107
 
98
- opts.on( "-p", "--plugin_ids PLUGINS", String,
99
- "A subset of plugin ids, for streaming mode only - not generally used manually.") do |plugins|
100
- options[:plugin_ids] = plugins.split(",").map(&:to_i)
101
- end
102
-
103
- opts.on( "-k", "--streaming_key KEY", String,
104
- "for streaming mode only - not generally used manually.") do |streaming_key|
105
- options[:streaming_key] = streaming_key
106
- end
107
-
108
108
  opts.separator " "
109
109
  opts.separator "Troubleshooting Options:"
110
110
  opts.separator "--------------------------------------------------------------------------"
@@ -164,6 +164,8 @@ module Scout
164
164
  @level = options[:level] || "info"
165
165
  @force = options[:force] || false
166
166
  @server_name = options[:server_name]
167
+ @http_proxy = options[:http_proxy] || ""
168
+ @https_proxy = options[:https_proxy] || ""
167
169
 
168
170
  @options = options
169
171
  @args = args
@@ -22,7 +22,7 @@ module Scout
22
22
 
23
23
  puts "\nAttempting to contact the server..."
24
24
  begin
25
- Scout::Server.new(server, key, history, log) do |scout|
25
+ Scout::Server.new(server, key, history, log, @http_proxy, @https_proxy) do |scout|
26
26
  scout.fetch_plan
27
27
  scout.run_plugins_by_plan
28
28
  end
@@ -9,7 +9,7 @@ module Scout
9
9
  configuration_directory = config_dir
10
10
  log.debug("Configuration directory is #{configuration_directory} ") if log
11
11
  # TODO: too much external logic of command doing things TO server. This should be moved into the server class.
12
- @scout = Scout::Server.new(server, key, history, log, server_name)
12
+ @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy)
13
13
  @scout.load_history
14
14
 
15
15
  unless $stdin.tty?
@@ -19,15 +19,15 @@ module Scout
19
19
 
20
20
  @scout.fetch_plan
21
21
 
22
- log.info "streamer command=#{@scout.streamer_command}"
23
- # Spawn streamer if directed to, or stop it. @scout.streamer_command should only be [start|stop]
24
- if @scout.streamer_command.is_a?(String) && @scout.streamer_command.start_with?("start") || @scout.streamer_command == "stop"
25
- tokens = @scout.streamer_command.split(",")
26
- tokens.shift # gets rid of the "start"
27
- streaming_key=tokens.shift
28
- plugin_ids = tokens.map(&:to_i)
29
- stream=Scout::Command::Stream.new(@options.merge(:streaming_key=>streaming_key,:plugin_ids=>plugin_ids), [key, @scout.streamer_command])
30
- stream.run
22
+ # Spawn or stop streamer as needed
23
+ if @scout.streamer_command.is_a?(String)
24
+ if @scout.streamer_command.start_with?("start")
25
+ log.info "streamer command: start"
26
+ Scout::StreamerDaemon.start_daemon(history, @scout.streamer_command)
27
+ elsif @scout.streamer_command == "stop"
28
+ log.info "streamer command: stop"
29
+ Scout::StreamerDaemon.stop_daemon(history)
30
+ end
31
31
  end
32
32
 
33
33
  # Check in if appropriate
@@ -11,7 +11,7 @@ module Scout
11
11
  VERIFY_MODE = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
12
12
 
13
13
  def run
14
- url, *provided_options = @args
14
+ url = @args.first
15
15
  # read the plugin_code from the file specified
16
16
  if url.nil? or url == ''
17
17
  puts "Please specify the path to the plugin (scout sign /path/to/plugin.rb)"
@@ -35,7 +35,13 @@ module Scout
35
35
 
36
36
  puts "Posting Signature..."
37
37
  uri = URI.parse(url)
38
- http = Net::HTTP.new(uri.host, uri.port)
38
+
39
+ # take care of http/https proxy, if specified in command line options
40
+ # Given a blank string, the proxy_uri URI instance's host/port/user/pass will be nil
41
+ # Net::HTTP::Proxy returns a regular Net::HTTP class if the first argument (host) is nil
42
+ proxy_uri = URI.parse(uri.is_a?(URI::HTTPS) ? @https_proxy : @http_proxy)
43
+ http=Net::HTTP::Proxy(proxy_uri.host,proxy_uri.port,proxy_uri.user,proxy_uri.port).new(uri.host, uri.port)
44
+
39
45
  if uri.is_a?(URI::HTTPS)
40
46
  http.use_ssl = true
41
47
  http.ca_file = CA_FILE
@@ -45,7 +45,7 @@ module Scout
45
45
  puts "== You haven't provided any options for running this plugin."
46
46
  end
47
47
 
48
- Scout::Server.new(nil, nil, history, log) do |scout|
48
+ Scout::Server.new(nil, nil, history, log, @http_proxy, @https_proxy) do |scout|
49
49
  scout.prepare_checkin
50
50
  scout.process_plugin( 'interval' => 0,
51
51
  'plugin_id' => 1,
@@ -26,13 +26,15 @@ module Scout
26
26
  attr_reader :streamer_command
27
27
 
28
28
  # Creates a new Scout Server connection.
29
- def initialize(server, client_key, history_file, logger = nil, server_name=nil)
29
+ def initialize(server, client_key, history_file, logger = nil, server_name=nil, http_proxy='', https_proxy='')
30
30
  @server = server
31
31
  @client_key = client_key
32
32
  @history_file = history_file
33
33
  @history = Hash.new
34
34
  @logger = logger
35
35
  @server_name = server_name
36
+ @http_proxy = http_proxy
37
+ @https_proxy = https_proxy
36
38
  @plugin_plan = []
37
39
  @plugins_with_signature_errors = []
38
40
  @directives = {} # take_snapshots, interval, sleep_interval
@@ -231,7 +233,7 @@ module Scout
231
233
  def time_to_checkin?
232
234
  @history['last_checkin'] == nil ||
233
235
  @directives['interval'] == nil ||
234
- (Time.now.to_i - Time.at(@history['last_checkin']).to_i).abs+15 > @directives['interval'].to_i*60
236
+ (Time.now.to_i - Time.at(@history['last_checkin']).to_i).abs+15+sleep_interval > @directives['interval'].to_i*60
235
237
  rescue
236
238
  debug "Failed to calculate time_to_checkin. @history['last_checkin']=#{@history['last_checkin']}. "+
237
239
  "@directives['interval']=#{@directives['interval']}. Time.now.to_i=#{Time.now.to_i}"
@@ -481,7 +483,7 @@ module Scout
481
483
  contents=File.read(@history_file)
482
484
  begin
483
485
  @history = YAML.load(contents)
484
- rescue => e
486
+ rescue
485
487
  backup_path=File.join(File.dirname(@history_file), "history.corrupt")
486
488
  info "Couldn't parse the history file. Deleting it and resetting to an empty history file. Keeping a backup at #{backup_path}"
487
489
  File.open(backup_path,"w"){|f|f.write contents}
@@ -546,9 +548,6 @@ module Scout
546
548
  debug $!.message
547
549
  debug $!.backtrace
548
550
  end
549
-
550
-
551
- private
552
551
 
553
552
  # Called during initialization; loads the plugin_configs (local plugin configurations for passwords, etc)
554
553
  # if the file is there. Returns a hash like {"db.username"=>"secr3t"}
@@ -2,31 +2,34 @@ require 'rubygems'
2
2
  require 'json'
3
3
 
4
4
  module Scout
5
- class Streamer < Scout::ServerBase
5
+ class PluginTimeoutError < RuntimeError; end
6
+ class Streamer
6
7
  MAX_DURATION = 60*30 # will shut down automatically after this many seconds
7
8
  SLEEP = 1
8
9
 
9
10
  # * history_file is the *path* to the history file
10
11
  # * plugin_ids is an array of integers
11
- def initialize(server, client_key, history_file, plugin_ids, streaming_key, logger = nil)
12
- @server = server
13
- @client_key = client_key
12
+ def initialize(history_file, streaming_key, p_app_id, p_key, p_secret, plugin_ids, logger = nil)
13
+ @@continue_streaming = true
14
14
  @history_file = history_file
15
15
  @history = Hash.new
16
16
  @logger = logger
17
17
 
18
18
  @plugin_hashes = []
19
19
 
20
- Pusher.app_id = '11495'
21
- Pusher.key = 'a95aa7293cd158100246'
22
- Pusher.secret = '9c13ccfe325fe3ae682d'
20
+ Pusher.app_id=p_app_id
21
+ Pusher.key=p_key
22
+ Pusher.secret=p_secret
23
+
24
+ #[[:app_id,p_app_id],[:key,p_key],[:secret,p_secret]].each { |p| Pusher.send p.first, p.last}
23
25
 
24
26
  streamer_start_time = Time.now
25
27
 
26
28
  info("Streamer PID=#{$$} starting")
27
29
 
28
30
  hostname=Socket.gethostname
29
- # load history
31
+
32
+ # load plugin history
30
33
  load_history
31
34
 
32
35
  # get the array of plugins, AKA the plugin plan
@@ -39,7 +42,7 @@ module Scout
39
42
 
40
43
  # main loop. Continue running until global $continue_streaming is set to false OR we've been running for MAX DURATION
41
44
  iteration=1 # use this to log the data at a couple points
42
- while(streamer_start_time+MAX_DURATION > Time.now && $continue_streaming) do
45
+ while(streamer_start_time+MAX_DURATION > Time.now && @@continue_streaming) do
43
46
  plugins=[]
44
47
  selected_plugins.each_with_index do |plugin_hash,i|
45
48
  # create an actual instance of the plugin
@@ -186,5 +189,10 @@ module Scout
186
189
  end
187
190
  end
188
191
 
192
+ # class method is used to stop the running deamon
193
+ def self.continue_streaming=(v)
194
+ @@continue_streaming=v
195
+ end
196
+
189
197
  end
190
198
  end
@@ -0,0 +1,58 @@
1
+ module Scout
2
+ class StreamerDaemon < DaemonSpawn::Base
3
+
4
+ # this is the public-facing method for starting the streaming daemon
5
+ def self.start_daemon(history_file, streamer_command)
6
+ streamer_log_file=File.join(File.dirname(history_file),"scout_streamer.log")
7
+ streamer_pid_file=File.join(File.dirname(history_file),"scout_streamer.pid")
8
+
9
+ daemon_spawn_options = {:log_file => streamer_log_file,
10
+ :pid_file => streamer_pid_file,
11
+ :sync_log => true,
12
+ :working_dir => File.dirname(history_file)}
13
+
14
+ # streamer command might look like: start,A0000000000123,a,b,c,1,3
15
+ tokens = streamer_command.split(",")
16
+ tokens.shift # gets rid of the "start"
17
+ streaming_key = tokens.shift
18
+ p_app_id = tokens.shift
19
+ p_key = tokens.shift
20
+ p_secret = tokens.shift
21
+ plugin_ids = tokens.map(&:to_i)
22
+
23
+ # we use STDOUT for the logger because daemon_spawn directs STDOUT to a log file
24
+ streamer_args = [history_file,streaming_key,p_app_id,p_key,p_secret,plugin_ids,Logger.new(STDOUT)]
25
+ if File.exists?(streamer_pid_file)
26
+ Scout::StreamerDaemon.restart(daemon_spawn_options, streamer_args)
27
+ else
28
+ Scout::StreamerDaemon.start(daemon_spawn_options, streamer_args)
29
+ end
30
+ end
31
+
32
+ # this is the public-facing method for stopping the streaming daemon
33
+ def self.stop_daemon(history_file)
34
+ streamer_log_file=File.join(File.dirname(history_file),"scout_streamer.log")
35
+ streamer_pid_file=File.join(File.dirname(history_file),"scout_streamer.pid")
36
+
37
+ daemon_spawn_options = {:log_file => streamer_log_file,
38
+ :pid_file => streamer_pid_file,
39
+ :sync_log => true,
40
+ :working_dir => File.dirname(history_file)}
41
+
42
+ Scout::StreamerDaemon.stop(daemon_spawn_options, [])
43
+ end
44
+
45
+
46
+ # this method is called by DaemonSpawn's class start method.
47
+ def start(streamer_args)
48
+ history,streaming_key,p_app_id,p_key,p_secret,plugin_ids,log = streamer_args
49
+ @scout = Scout::Streamer.new(history, streaming_key, p_app_id, p_key, p_secret, plugin_ids, log)
50
+ end
51
+
52
+ # this method is called by DaemonSpawn's class start method.
53
+ def stop
54
+ Scout::Streamer.continue_streaming = false
55
+ end
56
+
57
+ end
58
+ end
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.4.6.alpha"
2
+ VERSION = "5.5.0"
3
3
  end
@@ -409,17 +409,21 @@ mybar=100
409
409
 
410
410
  scout(@client.key) # to write the initial history file. Sinatra MUST be running
411
411
  $continue_streaming = true # so the streamer will run once
412
- streamer=Scout::Streamer.new("http://none", "bogus_client_key", PATH_TO_DATA_FILE, [@client.plugins.first.id]+plugins.map(&:id), "bogus_streaming_key",nil) # for debugging, make last arg Logger.new(STDOUT)
413
- res = Pusher::Channel.streamer_data # via the mock_streamer call
412
+ # for debugging, make last arg Logger.new(STDOUT)
413
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[@client.plugins.first.id]+plugins.map(&:id),nil)
414
+ end
414
415
 
415
- assert res.is_a?(Hash)
416
- assert res[:plugins].is_a?(Array)
417
- assert_equal 4, res[:plugins].size
418
- assert_equal 2, res[:plugins][0][:fields][:load]
419
- assert_equal 1, res[:plugins][1][:fields][:value]
420
- assert_equal 2, res[:plugins][2][:fields][:value]
421
- assert_equal 1, res[:plugins][3][:fields][:value]
422
- end # end of mock_pusher
416
+ streams = Pusher::Channel.streamer_data # set by the mock_pusher call
417
+ assert streams.is_a?(Array)
418
+ assert_equal 1, streams.size
419
+ res=streams.first
420
+ assert res.is_a?(Hash)
421
+ assert res[:plugins].is_a?(Array)
422
+ assert_equal 4, res[:plugins].size
423
+ assert_equal 2, res[:plugins][0][:fields][:load]
424
+ assert_equal 1, res[:plugins][1][:fields][:value]
425
+ assert_equal 2, res[:plugins][2][:fields][:value]
426
+ assert_equal 1, res[:plugins][3][:fields][:value]
423
427
  end
424
428
 
425
429
  # the local plugin shouldn't report
@@ -435,26 +439,31 @@ mybar=100
435
439
 
436
440
  mock_pusher do
437
441
  $continue_streaming = true # so the streamer will run once
438
- streamer=Scout::Streamer.new("http://none", "bogus_client_key", PATH_TO_DATA_FILE, [@client.plugins.first.id], "bogus_streaming_key",nil) # for debugging, make last arg Logger.new(STDOUT)
439
- res = Pusher::Channel.streamer_data # Pusher::Channel.streamer_data via the mock_streamer call
442
+ # for debugging, make last arg Logger.new(STDOUT)
443
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[@client.plugins.first.id],nil)
444
+ end
445
+ streams = Pusher::Channel.streamer_data # set by the mock_pusher call
446
+ assert streams.is_a?(Array)
447
+ assert_equal 1, streams.size
448
+ res=streams.first
440
449
 
441
- assert res.is_a?(Hash)
442
- assert res[:plugins].is_a?(Array)
443
- assert_equal 1, res[:plugins].size # this is NOT the local plugin, it's a regular plugin that's already there
444
- assert_equal 2, res[:plugins][0][:fields][:load]
445
- end # end of mock_pusher
450
+ assert res.is_a?(Hash)
451
+ assert res[:plugins].is_a?(Array)
452
+ assert_equal 1, res[:plugins].size # this is NOT the local plugin, it's a regular plugin that's already there
453
+ assert_equal 2, res[:plugins][0][:fields][:load]
446
454
  end
447
455
 
448
456
 
449
457
  # test streamer starting and stopping
450
458
  def test_streamer_process_management
451
459
  streamer_pid_file = File.join(AGENT_DIR, "scout_streamer.pid")
460
+ File.unlink(streamer_pid_file) if File.exist?(streamer_pid_file)
452
461
 
453
462
  test_should_run_first_time
454
463
 
455
464
  assert !File.exist?(streamer_pid_file)
456
465
 
457
- assert @client.update_attribute(:streamer_command, "start,A0000000000123,1,3")
466
+ assert @client.update_attribute(:streamer_command, "start,A0000000000123,a,b,c,1,3")
458
467
  scout(@client.key)
459
468
  assert File.exist?(streamer_pid_file)
460
469
  process_id = File.read(streamer_pid_file).to_i
@@ -475,15 +484,34 @@ mybar=100
475
484
  plugin = create_plugin(@client, "memory plugin", PLUGIN_FIXTURES[:memory][:code], PLUGIN_FIXTURES[:memory][:sig])
476
485
  scout(@client.key)
477
486
  #puts YAML.load(File.read(PATH_TO_DATA_FILE))['memory'].to_yaml
478
-
479
- $continue_streaming = true # so the streamer will start running
480
487
  # for debugging, make last arg Logger.new(STDOUT)
481
- streamer=Scout::Streamer.new("http://none", "bogus_client_key", PATH_TO_DATA_FILE, [plugin.id], "bogus_streaming_key",nil)
482
- res = Pusher::Channel.streamer_data # Pusher::Channel.streamer_data via the mock_pusher call
483
- assert_equal 3, res[:plugins][0][:fields][:v], "after the two streamer runs, this plugin should report v=3 -- it increments each run"
488
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[plugin.id],nil)
484
489
  end
490
+
491
+ streams = Pusher::Channel.streamer_data # set by the mock_pusher call
492
+ assert streams.is_a?(Array)
493
+ assert_equal 3, streams.size
494
+ res=streams.last
495
+ assert_equal 3, res[:plugins][0][:fields][:v], "after the two streamer runs, this plugin should report v=3 -- it increments each run"
485
496
  end
486
497
 
498
+ def test_new_plugin_instance_every_streamer_run
499
+ mock_pusher(2) do
500
+ plugin = create_plugin(@client, "caching plugin", PLUGIN_FIXTURES[:caching][:code], PLUGIN_FIXTURES[:caching][:sig])
501
+ scout(@client.key)
502
+ # for debugging, make last arg Logger.new(STDOUT)
503
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[plugin.id],nil)
504
+ end
505
+
506
+ streams = Pusher::Channel.streamer_data # set by the mock_pusher call
507
+ assert streams.is_a?(Array)
508
+ assert_equal 2, streams.size
509
+
510
+ # the plugin sets :v to be the current time, and caches it in a class variable. we're checking that they are NOT equal
511
+ assert_in_delta Time.now.to_i, streams.last[:plugins][0][:fields][:v], 5, "should be within a few seconds of now"
512
+ assert_in_delta Time.now.to_i, streams.first[:plugins][0][:fields][:v], 5, "should be within a few seconds of now"
513
+ assert_not_equal streams.first[:plugins][0][:fields][:v], streams.last[:plugins][0][:fields][:v]
514
+ end
487
515
 
488
516
  ######################
489
517
  ### Helper Methods ###
@@ -612,10 +640,13 @@ mybar=100
612
640
  def trigger!(event_name, data, socket=nil)
613
641
  @num_run_for_tests = @num_run_for_tests ? @num_run_for_tests+1 : 1
614
642
  # puts "in mock pusher trigger! This is run #{@num_run_for_tests} of #{$num_runs_for_mock_pusher}"
615
- @@streamer_data = data
643
+ @@streamer_data_temp ||= Array.new
644
+ @@streamer_data_temp << data
616
645
  if @num_run_for_tests >= $num_runs_for_mock_pusher
617
- $continue_streaming=false
646
+ Scout::Streamer.continue_streaming=false
618
647
  @num_run_for_tests=nil
648
+ @@streamer_data = @@streamer_data_temp.clone
649
+ @@streamer_data_temp = nil
619
650
  end
620
651
  end
621
652
  end
@@ -656,6 +687,16 @@ HXu5TIQLJ/+IYHIG2E5FWcbfddR8cmJkIl4zGs93IatQNTENksRzphob7Cz8
656
687
  wBwOHDG78kJ4TWEV5NIa5rLW8y2ltthfEPCTnS8/Zxa6h0qFtNrUWiU2KKtp
657
688
  xTbJ3RgWKUnAR3YrEGB/JjjkPN2FrsDRvlClGujaYIWpWGkf+GZcpUn+QYxP
658
689
  w7/kFz29Ds4hJRg2E2cWCHPtrD4dI0p/1iwP4XsxOw==
690
+ EOS
691
+ },
692
+ :caching=>{:code=>"class CachingPlugin < Scout::Plugin;def build_report; @v||= Time.now.to_i; report(:v=>@v);end;end",
693
+ :sig=><<EOS
694
+ zcEUdxS9h/iD/xYK1SbvTn2mi0vJzfgIkmrouzXeRbEsbcKTdOhc3nOBwUH5
695
+ SEOvQnPKmTiN7qaRiDZJypB/ldKxG4PL8zI0kL5G3AUZcxJBfqWe82jCKpyY
696
+ I49DWaBW4tZWM3j5T64+60ifPlKVXQMLVIYQtPTpVDMnftzfokDbBYsEhB2e
697
+ gNnsaAL5Nar+JE2GqM7nh79IgfXOrrYLdsv4zUJfex/OrKJS53ZCRnDcvlXu
698
+ pKFiS6IF2dJkIFlnNlYaXK5ZSXGANGY80Ji4ivz077JpuogQzrVkqHk13A1G
699
+ dGvCQOmVn51PKtmDm5DbfZaw4j4w+1pO2+G9Qm1y+A==
659
700
  EOS
660
701
  }
661
702
  } # end of PLUGIN_FIXTURES
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.4.6.alpha
5
- prerelease: 6
4
+ version: 5.5.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andre Lewis
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-12-17 00:00:00.000000000 Z
14
+ date: 2012-01-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: elif
18
- requirement: &70103547353160 !ruby/object:Gem::Requirement
18
+ requirement: &70362600075880 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70103547353160
26
+ version_requirements: *70362600075880
27
27
  description: ! 'Scout makes monitoring and reporting on your web applications as flexible
28
28
  and simple as possible.
29
29
 
@@ -50,7 +50,6 @@ files:
50
50
  - lib/scout/command/install.rb
51
51
  - lib/scout/command/run.rb
52
52
  - lib/scout/command/sign.rb
53
- - lib/scout/command/stream.rb
54
53
  - lib/scout/command/test.rb
55
54
  - lib/scout/command/troubleshoot.rb
56
55
  - lib/scout/daemon_spawn.rb
@@ -60,7 +59,7 @@ files:
60
59
  - lib/scout/server.rb
61
60
  - lib/scout/server_base.rb
62
61
  - lib/scout/streamer.rb
63
- - lib/scout/streamer_control.rb
62
+ - lib/scout/streamer_daemon.rb
64
63
  - lib/scout/version.rb
65
64
  - scout.gemspec
66
65
  - test/plugins/disk_usage.rb
@@ -208,7 +207,6 @@ files:
208
207
  - vendor/signature/.document
209
208
  - vendor/signature/.gitignore
210
209
  - vendor/signature/Gemfile
211
- - vendor/signature/Gemfile.lock
212
210
  - vendor/signature/LICENSE
213
211
  - vendor/signature/README.md
214
212
  - vendor/signature/Rakefile
@@ -234,9 +232,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
232
  required_rubygems_version: !ruby/object:Gem::Requirement
235
233
  none: false
236
234
  requirements:
237
- - - ! '>'
235
+ - - ! '>='
238
236
  - !ruby/object:Gem::Version
239
- version: 1.3.1
237
+ version: '0'
240
238
  requirements: []
241
239
  rubyforge_project: scout
242
240
  rubygems_version: 1.8.10
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env ruby -wKU
2
-
3
- require "logger"
4
-
5
- module Scout
6
- class Command
7
- class Stream < Command
8
- PID_FILENAME="streamer.pid"
9
-
10
- def run
11
- @key = @args[0]
12
- daemon_command = @args[1]
13
- @plugin_ids = @options[:plugin_ids]
14
-
15
- if !@key
16
- puts "usage: scout stream [your_scout_key] [start|stop]"
17
- exit(1)
18
- end
19
-
20
- # server and history methods are inherited from Scout::Command base class
21
- streamer_log_file=File.join(File.dirname(history),"scout_streamer.log")
22
- streamer_pid_file=File.join(File.dirname(history),"scout_streamer.pid")
23
-
24
- streamer_control_options = {:log_file => streamer_log_file,
25
- :pid_file => streamer_pid_file,
26
- :sync_log => true,
27
- :working_dir => File.dirname(history)}
28
-
29
- # we use STDOUT for the logger because daemon_spawn directs STDOUT to a log file
30
- streamer_control_args = [server, @key, history, @plugin_ids, @options[:streaming_key],Logger.new(STDOUT)]
31
-
32
- if daemon_command.include? "start" # can be 'start' or 'restart'
33
- if File.exists?(streamer_pid_file)
34
- puts("PID file existed. Restarting ...") if $stdin.tty?
35
- Scout::StreamerControl.restart(streamer_control_options,streamer_control_args)
36
- else
37
- puts("Starting ... ") if $stdin.tty?
38
- Scout::StreamerControl.start(streamer_control_options,streamer_control_args)
39
- end
40
- elsif daemon_command == "stop"
41
- puts("Stopping ...") if $stdin.tty?
42
- Scout::StreamerControl.stop(streamer_control_options,[])
43
- else
44
- puts "usage: scout stream [your_scout_key] [start|stop]"
45
- exit(1)
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,43 +0,0 @@
1
- module Scout
2
- class StreamerControl < DaemonSpawn::Base
3
-
4
- # args are: server, key, history, plugin_ids, streaming_key, log
5
- def start(args)
6
- #puts "StreamerControl#start PID=#{pid}"
7
- server,key,history,plugin_ids,streaming_key,log = args
8
- $continue_streaming = true #needed for streamer to loop
9
-
10
- @scout = Scout::Streamer.new(server, key, history, plugin_ids, streaming_key, log)
11
- # puts "StreamerControl - done. Removing pid_file at #{pid_file} containing PID=#{pid}"
12
- File.unlink(pid_file) if File.exists?(pid_file) # a better way of doing this?
13
- end
14
-
15
- def stop
16
- $continue_streaming = false
17
- end
18
- end
19
- end
20
-
21
-
22
- # This is how to start using this file as a start/stop command processor, and passing arguments in via command line:
23
- # Since there's no second argument to StreamerControl.spawn!, it uses command-line arguments.
24
- #Scout::StreamerControl.spawn!({:log_file => File.expand_path('~/.scout/scout_streamer.log'),
25
- # :pid_file => File.expand_path('~/.scout/scout_streamer.pid'),
26
- # :sync_log => true,
27
- # :working_dir => File.dirname(__FILE__)})
28
-
29
-
30
- # This is how you start it from anywhere in code:
31
- # Since there's a second argument to StreamerControl.spawn!, it uses those instead of command-line arguments.
32
- #Scout::StreamerControl.start({:log_file => File.expand_path('~/.scout/scout_streamer.log'),
33
- # :pid_file => File.expand_path('~/.scout/scout_streamer.pid'),
34
- # :sync_log => true,
35
- # :working_dir => File.dirname(__FILE__)},
36
- # ["ServerInstance", "abcd-1234-123g2-12321", "~/.scout/history.yml",[1,2,3,4],nil])
37
-
38
- # This is how you stop in anywhere in code:
39
- # Since there's a second argument to StreamerControl.spawn!, it uses those instead of command-line arguments.
40
- #Scout::StreamerControl.stop({:log_file => File.expand_path('~/.scout/scout_streamer.log'),
41
- # :pid_file => File.expand_path('~/.scout/scout_streamer.pid'),
42
- # :sync_log => true,
43
- # :working_dir => File.dirname(__FILE__)},[])