scout 5.6.6 → 5.6.7.pre

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ # 5.6.7
2
+
3
+ * changed fqdn override to hostname override. We no longer send fqdn.
4
+ * hostname is now send exclusively in the URL -- it is no longer sent in the HTTP headers
5
+
1
6
  # 5.6.6
2
7
 
3
8
  * Fix for urlify query string in Ruby 1.8.6.
@@ -19,7 +19,7 @@ module Scout
19
19
 
20
20
  puts "\nAttempting to contact the server..."
21
21
  begin
22
- Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, fqdn) do |scout|
22
+ Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, @hostname) do |scout|
23
23
  scout.fetch_plan
24
24
  scout.run_plugins_by_plan
25
25
  end
@@ -7,10 +7,10 @@ module Scout
7
7
  key = @args.first
8
8
  # TODO: this is an awkward way to force creation of the config directory. Could use a little refactoring.
9
9
  configuration_directory = config_dir
10
- log.debug("Running Scout [#{Scout::VERSION}] on #{@fqdn}") if log
10
+ log.debug("Running Scout [#{Scout::VERSION}] on #{@hostname}") if log
11
11
  log.debug("Configuration directory is #{configuration_directory} ") if log
12
12
  # TODO: too much external logic of command doing things TO server. This should be moved into the server class.
13
- @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, fqdn)
13
+ @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, @hostname)
14
14
  @scout.load_history
15
15
 
16
16
  unless $stdin.tty?
@@ -10,8 +10,7 @@ module Scout
10
10
  class Command
11
11
  class APITimeoutError < RuntimeError; end
12
12
 
13
- HTTP_HEADERS = { "Client-Version" => Scout::VERSION,
14
- "Client-Hostname" => Socket.gethostname}
13
+ HTTP_HEADERS = { "Client-Version" => Scout::VERSION }
15
14
 
16
15
  class Troubleshoot < Command
17
16
 
@@ -27,8 +26,7 @@ module Scout
27
26
  puts "Gathering troubleshooting information about your Scout install ... "
28
27
 
29
28
  heading "Scout Info"
30
- bullet "Hostname", Socket.gethostname
31
- bullet "FQDN", @fqdn
29
+ bullet "Hostname", @hostname
32
30
  bullet "History file", history
33
31
  bullet "Version", Scout::VERSION
34
32
 
data/lib/scout/command.rb CHANGED
@@ -87,9 +87,9 @@ module Scout
87
87
  "Optional https proxy for SSL traffic." ) do |https_proxy|
88
88
  options[:https_proxy] = https_proxy
89
89
  end
90
- opts.on("--fqdn FQDN", String,
91
- "Optional fully qualified domain name override." ) do |fqdn|
92
- options[:fqdn] = fqdn
90
+ opts.on("--hostname HOSTNAME", String,
91
+ "Optionally override the hostname." ) do |hostname|
92
+ options[:hostname] = hostname
93
93
  end
94
94
 
95
95
  opts.separator " "
@@ -177,8 +177,7 @@ module Scout
177
177
  @server_name = options[:server_name]
178
178
  @http_proxy = options[:http_proxy] || ""
179
179
  @https_proxy = options[:https_proxy] || ""
180
- @fqdn = (options[:fqdn] || `hostname -f`).chomp
181
-
180
+ @hostname = options[:hostname] || Socket.gethostname
182
181
  @options = options
183
182
  @args = args
184
183
 
@@ -190,7 +189,7 @@ module Scout
190
189
 
191
190
  end
192
191
 
193
- attr_reader :server, :history, :config_dir, :log_path, :server_name, :fqdn
192
+ attr_reader :server, :history, :config_dir, :log_path, :server_name, :hostname
194
193
 
195
194
 
196
195
  def verbose?
data/lib/scout/server.rb CHANGED
@@ -27,7 +27,7 @@ module Scout
27
27
  attr_reader :client_key
28
28
 
29
29
  # Creates a new Scout Server connection.
30
- def initialize(server, client_key, history_file, logger = nil, server_name=nil, http_proxy='', https_proxy='', roles='', fqdn = nil)
30
+ def initialize(server, client_key, history_file, logger = nil, server_name=nil, http_proxy='', https_proxy='', roles='', hostname = nil)
31
31
  @server = server
32
32
  @client_key = client_key
33
33
  @history_file = history_file
@@ -37,7 +37,7 @@ module Scout
37
37
  @http_proxy = http_proxy
38
38
  @https_proxy = https_proxy
39
39
  @roles = roles || ''
40
- @fqdn = fqdn
40
+ @hostname = hostname
41
41
  @plugin_plan = []
42
42
  @plugins_with_signature_errors = []
43
43
  @directives = {} # take_snapshots, interval, sleep_interval
@@ -49,7 +49,6 @@ module Scout
49
49
  @history_tmp_file = history_file+'.tmp'
50
50
  @plugin_config = load_plugin_configs(@plugin_config_path)
51
51
  @data_file = Scout::DataFile.new(@history_file,@logger)
52
-
53
52
  # the block is only passed for install and test, since we split plan retrieval outside the lockfile for run
54
53
  if block_given?
55
54
  load_history
@@ -61,7 +60,7 @@ module Scout
61
60
  def refresh?
62
61
  return true if !ping_key or account_public_key_changed? # fetch the plan again if the account key is modified/created
63
62
 
64
- url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&fqdn=#{URI.encode(@fqdn)}")
63
+ url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&hostname=#{URI.encode(@hostname)}")
65
64
 
66
65
  headers = {"x-scout-tty" => ($stdin.tty? ? 'true' : 'false')}
67
66
  if @history["plan_last_modified"] and @history["old_plugins"]
@@ -16,7 +16,6 @@ module Scout
16
16
 
17
17
  # Headers passed up with all API requests.
18
18
  HTTP_HEADERS = { "Client-Version" => Scout::VERSION,
19
- "Client-Hostname" => Socket.gethostname,
20
19
  "Accept-Encoding" => "gzip" }
21
20
 
22
21
 
@@ -29,7 +28,7 @@ module Scout
29
28
  "/clients/CLIENT_KEY/#{url_name}.scout".
30
29
  gsub(/\bCLIENT_KEY\b/, @client_key).
31
30
  gsub(/\b[A-Z_]+\b/) { |k| options[k.downcase.to_sym] || k })
32
- uri.query = ["roles=#{@roles}","fqdn=#{URI.encode(@fqdn)}","tty=#{$stdin.tty? ? 'y' : 'n'}"].join('&')
31
+ uri.query = ["roles=#{@roles}","hostname=#{URI.encode(@hostname)}","tty=#{$stdin.tty? ? 'y' : 'n'}"].join('&')
33
32
  uri
34
33
  end
35
34
 
@@ -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, logger = nil)
12
+ def initialize(history_file, streaming_key, p_app_id, p_key, p_secret, plugin_ids, hostname, logger = nil)
13
13
  @@continue_streaming = true
14
14
  @history_file = history_file
15
15
  @history = Hash.new
@@ -27,8 +27,6 @@ module Scout
27
27
 
28
28
  info("Streamer PID=#{$$} starting")
29
29
 
30
- fqdn=`hostname -f`
31
-
32
30
  # load plugin history
33
31
  load_history
34
32
 
@@ -72,7 +70,7 @@ module Scout
72
70
  :class=>plugin_hash['code_class']}
73
71
  end
74
72
 
75
- bundle={:hostname=>fqdn,
73
+ bundle={:hostname=>hostname,
76
74
  :server_time=>Time.now.strftime("%I:%M:%S %p"),
77
75
  :num_processes=>`ps -e | wc -l`.chomp.to_i,
78
76
  :plugins=>plugins }
@@ -2,7 +2,7 @@ module Scout
2
2
  class StreamerDaemon < DaemonSpawn::Base
3
3
 
4
4
  # this is the public-facing method for starting the streaming daemon
5
- def self.start_daemon(history_file, streamer_command)
5
+ def self.start_daemon(history_file, streamer_command, hostname)
6
6
  streamer_log_file=File.join(File.dirname(history_file),"scout_streamer.log")
7
7
  streamer_pid_file=File.join(File.dirname(history_file),"scout_streamer.pid")
8
8
 
@@ -21,7 +21,7 @@ module Scout
21
21
  plugin_ids = tokens.map(&:to_i)
22
22
 
23
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)]
24
+ streamer_args = [history_file,streaming_key,p_app_id,p_key,p_secret,plugin_ids,hostname,Logger.new(STDOUT)]
25
25
  if File.exists?(streamer_pid_file)
26
26
  Scout::StreamerDaemon.restart(daemon_spawn_options, streamer_args)
27
27
  else
@@ -45,8 +45,8 @@ module Scout
45
45
 
46
46
  # this method is called by DaemonSpawn's class start method.
47
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)
48
+ history,streaming_key,p_app_id,p_key,p_secret,plugin_ids,hostname,log = streamer_args
49
+ @scout = Scout::Streamer.new(history, streaming_key, p_app_id, p_key, p_secret, plugin_ids, hostname, log)
50
50
  end
51
51
 
52
52
  # this method is called by DaemonSpawn's class start method.
data/lib/scout/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.6.6"
2
+ VERSION = "5.6.7.pre"
3
3
  end
data/test/scout_test.rb CHANGED
@@ -60,7 +60,6 @@ class ScoutTest < Test::Unit::TestCase
60
60
  @db_role=@roles_account.roles.find_by_name("db")
61
61
  @app_role=@roles_account.roles.find_by_name("app")
62
62
  @hostname = `hostname`.chomp
63
- @fqdn = `hostname -f`.chomp
64
63
  end
65
64
 
66
65
  def test_should_checkin_during_interactive_install
@@ -416,7 +415,7 @@ mybar=100
416
415
  scout(@client.key) # to write the initial history file. Sinatra MUST be running
417
416
  $continue_streaming = true # so the streamer will run once
418
417
  # for debugging, make last arg Logger.new(STDOUT)
419
- Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[@client.plugins.first.id]+plugins.map(&:id),nil)
418
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[@client.plugins.first.id]+plugins.map(&:id),"blade",nil)
420
419
  end
421
420
 
422
421
  streams = Pusher::Channel.streamer_data # set by the mock_pusher call
@@ -446,7 +445,7 @@ mybar=100
446
445
  mock_pusher do
447
446
  $continue_streaming = true # so the streamer will run once
448
447
  # for debugging, make last arg Logger.new(STDOUT)
449
- Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[@client.plugins.first.id],nil)
448
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[@client.plugins.first.id],"blade",nil)
450
449
  end
451
450
  streams = Pusher::Channel.streamer_data # set by the mock_pusher call
452
451
  assert streams.is_a?(Array)
@@ -468,7 +467,7 @@ mybar=100
468
467
  test_should_run_first_time
469
468
 
470
469
  assert !File.exist?(streamer_pid_file)
471
-
470
+ puts @client.hostname
472
471
  assert @client.update_attribute(:streamer_command, "start,A0000000000123,a,b,c,1,3")
473
472
  exec_scout(@client.key)
474
473
  assert File.exist?(streamer_pid_file)
@@ -491,7 +490,7 @@ mybar=100
491
490
  exec_scout(@client.key)
492
491
  #puts YAML.load(File.read(PATH_TO_DATA_FILE))['memory'].to_yaml
493
492
  # for debugging, make last arg Logger.new(STDOUT)
494
- Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[plugin.id],nil)
493
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[plugin.id],"blade",nil)
495
494
  end
496
495
 
497
496
  streams = Pusher::Channel.streamer_data # set by the mock_pusher call
@@ -506,7 +505,7 @@ mybar=100
506
505
  plugin = create_plugin(@client, "caching plugin", PLUGIN_FIXTURES[:caching][:code], PLUGIN_FIXTURES[:caching][:sig])
507
506
  exec_scout(@client.key)
508
507
  # for debugging, make last arg Logger.new(STDOUT)
509
- Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[plugin.id],nil)
508
+ Scout::Streamer.new(PATH_TO_DATA_FILE,"bogus_streaming_key","a","b","c",[plugin.id],"blade",nil)
510
509
  end
511
510
 
512
511
  streams = Pusher::Channel.streamer_data # set by the mock_pusher call
@@ -569,23 +568,11 @@ mybar=100
569
568
 
570
569
  end
571
570
 
572
- def test_fqdn
573
- scout(@roles_account.key)
574
- client=@roles_account.clients.last
575
- assert_equal @fqdn, client.fqdn
576
- end
577
-
578
- def test_fqdn_override
579
- fqdn_override="app1.production.foobar.com"
580
- scout(@roles_account.key, "--fqdn", fqdn_override)
581
- client=@roles_account.clients.last
582
- assert_equal fqdn_override, client.fqdn
583
- end
584
-
585
- def test_fqdn_has_newline
586
- scout(@roles_account.key, "--fqdn", "db-1.foobar.com\n")
571
+ def test_hostname_override
572
+ hostname_override="app1.production.foobar.com"
573
+ scout(@roles_account.key, "--hostname", hostname_override)
587
574
  client=@roles_account.clients.last
588
- assert_equal "db-1.foobar.com", client.fqdn
575
+ assert_equal hostname_override, client.hostname
589
576
  end
590
577
 
591
578
 
@@ -722,7 +709,7 @@ mybar=100
722
709
  def create_plugin(client,name, code, signature)
723
710
  p=client.plugins.create(:name=>name)
724
711
  PluginMeta.create(:plugin=>p)
725
- p.meta.code=code
712
+ p.reload.meta.code=code
726
713
  p.code_md5_signature=Digest::MD5.hexdigest(code)
727
714
  p.signature=signature
728
715
  p.save
metadata CHANGED
@@ -1,44 +1,40 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: scout
3
- version: !ruby/object:Gem::Version
4
- version: 5.6.6
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ version: 5.6.7.pre
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Andre Lewis
9
8
  - Derek Haynes
10
9
  - James Edward Gray II
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2013-04-23 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+
14
+ date: 2013-04-25 00:00:00 -07:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
17
18
  name: elif
18
- requirement: !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
24
19
  type: :runtime
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: '0'
32
- description: ! 'The scout gem reports metrics to scoutapp.com, an easy-to-use hosted
33
- server monitoring service.
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: "0"
26
+ version:
27
+ description: |
28
+ The scout gem reports metrics to scoutapp.com, an easy-to-use hosted server monitoring service.
34
29
 
35
- '
36
30
  email: support@scoutapp.com
37
- executables:
31
+ executables:
38
32
  - scout
39
33
  extensions: []
34
+
40
35
  extra_rdoc_files: []
41
- files:
36
+
37
+ files:
42
38
  - .gitignore
43
39
  - CHANGELOG.markdown
44
40
  - Gemfile
@@ -223,32 +219,34 @@ files:
223
219
  - vendor/signature/spec/signature_spec.rb
224
220
  - vendor/signature/spec/spec_helper.rb
225
221
  - vendor/util/lib/core_extensions.rb
222
+ has_rdoc: true
226
223
  homepage: http://scoutapp.com
227
224
  licenses: []
225
+
228
226
  post_install_message:
229
227
  rdoc_options: []
230
- require_paths:
228
+
229
+ require_paths:
231
230
  - lib
232
- required_ruby_version: !ruby/object:Gem::Requirement
233
- none: false
234
- requirements:
235
- - - ! '>='
236
- - !ruby/object:Gem::Version
237
- version: '0'
238
- required_rubygems_version: !ruby/object:Gem::Requirement
239
- none: false
240
- requirements:
241
- - - ! '>='
242
- - !ruby/object:Gem::Version
243
- version: '0'
231
+ required_ruby_version: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ version: "0"
236
+ version:
237
+ required_rubygems_version: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">"
240
+ - !ruby/object:Gem::Version
241
+ version: 1.3.1
242
+ version:
244
243
  requirements: []
244
+
245
245
  rubyforge_project: scout
246
- rubygems_version: 1.8.24
246
+ rubygems_version: 1.3.5
247
247
  signing_key:
248
248
  specification_version: 3
249
- summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby
250
- gem reports metrics to our service. The agent runs plugins, configured via the Scout
251
- web interface, to monitor a server.
252
- test_files:
249
+ 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.
250
+ test_files:
253
251
  - test/plugins/disk_usage.rb
254
252
  - test/scout_test.rb