scout 5.6.3.pre → 5.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 5.6.4
2
+
3
+ * send FQDN in addition to hostname, and provide an override
4
+
1
5
  # 5.6.3
2
6
 
3
7
  * Removing $VERBOSE = true
data/lib/scout/command.rb CHANGED
@@ -87,6 +87,10 @@ 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
93
+ end
90
94
 
91
95
  opts.separator " "
92
96
  opts.separator "Common Options:"
@@ -173,6 +177,7 @@ module Scout
173
177
  @server_name = options[:server_name]
174
178
  @http_proxy = options[:http_proxy] || ""
175
179
  @https_proxy = options[:https_proxy] || ""
180
+ @fqdn = options[:fqdn] || `hostname -f`
176
181
 
177
182
  @options = options
178
183
  @args = args
@@ -185,7 +190,7 @@ module Scout
185
190
 
186
191
  end
187
192
 
188
- attr_reader :server, :history, :config_dir, :log_path, :server_name
193
+ attr_reader :server, :history, :config_dir, :log_path, :server_name, :fqdn
189
194
 
190
195
 
191
196
  def verbose?
@@ -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) do |scout|
22
+ Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, fqdn) 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 #{Socket.gethostname}") if log
10
+ log.debug("Running Scout [#{Scout::VERSION}] on #{@fqdn}") 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)
13
+ @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy, @roles, fqdn)
14
14
  @scout.load_history
15
15
 
16
16
  unless $stdin.tty?
@@ -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, server_name, @http_proxy, @https_proxy, nil) do |scout|
48
+ Scout::Server.new(nil, nil, history, log, server_name, @http_proxy, @https_proxy, nil, nil) do |scout|
49
49
  scout.prepare_checkin
50
50
  scout.process_plugin( 'interval' => 0,
51
51
  'plugin_id' => 1,
@@ -28,6 +28,7 @@ module Scout
28
28
 
29
29
  heading "Scout Info"
30
30
  bullet "Hostname", Socket.gethostname
31
+ bullet "FQDN", @fqdn
31
32
  bullet "History file", history
32
33
  bullet "Version", Scout::VERSION
33
34
 
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='')
30
+ def initialize(server, client_key, history_file, logger = nil, server_name=nil, http_proxy='', https_proxy='', roles='', fqdn = nil)
31
31
  @server = server
32
32
  @client_key = client_key
33
33
  @history_file = history_file
@@ -37,6 +37,7 @@ module Scout
37
37
  @http_proxy = http_proxy
38
38
  @https_proxy = https_proxy
39
39
  @roles = roles || ''
40
+ @fqdn = fqdn
40
41
  @plugin_plan = []
41
42
  @plugins_with_signature_errors = []
42
43
  @directives = {} # take_snapshots, interval, sleep_interval
@@ -60,7 +61,7 @@ module Scout
60
61
  def refresh?
61
62
  return true if !ping_key or account_public_key_changed? # fetch the plan again if the account key is modified/created
62
63
 
63
- url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&hostname=#{Socket.gethostname}")
64
+ url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&fqdn=#{@fqdn}")
64
65
 
65
66
  headers = {"x-scout-tty" => ($stdin.tty? ? 'true' : 'false')}
66
67
  if @history["plan_last_modified"] and @history["old_plugins"]
@@ -29,7 +29,7 @@ module Scout
29
29
  "/clients/CLIENT_KEY/#{url_name}.scout".
30
30
  gsub(/\bCLIENT_KEY\b/, @client_key).
31
31
  gsub(/\b[A-Z_]+\b/) { |k| options[k.downcase.to_sym] || k },
32
- "?roles=#{@roles}&hostname=#{Socket.gethostname}&tty=#{$stdin.tty? ? 'y' : 'n'}")
32
+ "?roles=#{@roles}&fqdn=#{@fqdn}&tty=#{$stdin.tty? ? 'y' : 'n'}")
33
33
  end
34
34
 
35
35
  def post(url, error, body, headers = Hash.new, &response_handler)
@@ -27,7 +27,7 @@ module Scout
27
27
 
28
28
  info("Streamer PID=#{$$} starting")
29
29
 
30
- hostname=Socket.gethostname
30
+ fqdn=`hostname -f`
31
31
 
32
32
  # load plugin history
33
33
  load_history
@@ -72,7 +72,7 @@ module Scout
72
72
  :class=>plugin_hash['code_class']}
73
73
  end
74
74
 
75
- bundle={:hostname=>hostname,
75
+ bundle={:hostname=>fqdn,
76
76
  :server_time=>Time.now.strftime("%I:%M:%S %p"),
77
77
  :num_processes=>`ps -e | wc -l`.chomp.to_i,
78
78
  :plugins=>plugins }
data/lib/scout/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.6.3.pre"
2
+ VERSION = "5.6.4"
3
3
  end
data/test/scout_test.rb CHANGED
@@ -60,6 +60,7 @@ 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
63
64
  end
64
65
 
65
66
  def test_should_checkin_during_interactive_install
@@ -547,7 +548,7 @@ mybar=100
547
548
  assert_equal 2, client.plugins.count
548
549
 
549
550
  client.plugins.each do |plugin|
550
- assert @app_role.plugin_templates.include?(plugin.plugin_definition), "#{plugin} should be included in the app role"
551
+ assert @app_role.plugin_templates.include?(plugin.plugin_template), "#{plugin} should be included in the app role"
551
552
  end
552
553
 
553
554
  # second checkin - add a role
@@ -563,11 +564,25 @@ mybar=100
563
564
  assert_equal 2, client.plugins.count
564
565
 
565
566
  client.plugins.each do |plugin|
566
- assert @db_role.plugin_templates.include?(plugin.plugin_definition), "#{plugin} should be included in the db role"
567
+ assert @db_role.plugin_templates.include?(plugin.plugin_template), "#{plugin} should be included in the db role"
567
568
  end
568
569
 
569
570
  end
570
571
 
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
+
571
586
  ######################
572
587
  ### Helper Methods ###
573
588
  ######################
@@ -612,7 +627,7 @@ mybar=100
612
627
  # you can use this, but you have to create the plugin file and clean up afterwards.
613
628
  # Or, you can use the blog version below
614
629
  def scout_test(path_to_test_plugin, opts = String.new)
615
- `bin/scout test #{path_to_test_plugin} -d #{PATH_TO_DATA_FILE} #{opts}`
630
+ `bin/scout test #{path_to_test_plugin} -d #{PATH_TO_DATA_FILE} #{opts} -v -ldebug`
616
631
  end
617
632
 
618
633
  # The preferred way to test the agent in test mode. This creates a plugin file with the code you provide,
metadata CHANGED
@@ -1,39 +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.3.pre
5
- prerelease: 6
3
+ version: !ruby/object:Gem::Version
4
+ version: 5.6.4
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-02 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+
14
+ date: 2013-04-11 00:00:00 -07:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
17
18
  name: elif
18
- requirement: &2156450540 !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: *2156450540
27
- description: ! 'The scout gem reports metrics to scoutapp.com, an easy-to-use hosted
28
- 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.
29
29
 
30
- '
31
30
  email: support@scoutapp.com
32
- executables:
31
+ executables:
33
32
  - scout
34
33
  extensions: []
34
+
35
35
  extra_rdoc_files: []
36
- files:
36
+
37
+ files:
37
38
  - .gitignore
38
39
  - CHANGELOG.markdown
39
40
  - Gemfile
@@ -218,32 +219,34 @@ files:
218
219
  - vendor/signature/spec/signature_spec.rb
219
220
  - vendor/signature/spec/spec_helper.rb
220
221
  - vendor/util/lib/core_extensions.rb
222
+ has_rdoc: true
221
223
  homepage: http://scoutapp.com
222
224
  licenses: []
225
+
223
226
  post_install_message:
224
227
  rdoc_options: []
225
- require_paths:
228
+
229
+ require_paths:
226
230
  - lib
227
- required_ruby_version: !ruby/object:Gem::Requirement
228
- none: false
229
- requirements:
230
- - - ! '>='
231
- - !ruby/object:Gem::Version
232
- version: '0'
233
- required_rubygems_version: !ruby/object:Gem::Requirement
234
- none: false
235
- requirements:
236
- - - ! '>'
237
- - !ruby/object:Gem::Version
238
- version: 1.3.1
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: "0"
242
+ version:
239
243
  requirements: []
244
+
240
245
  rubyforge_project: scout
241
- rubygems_version: 1.8.10
246
+ rubygems_version: 1.3.5
242
247
  signing_key:
243
248
  specification_version: 3
244
- summary: Scout is an easy-to-use hosted server monitoring service. The scout Ruby
245
- gem reports metrics to our service. The agent runs plugins, configured via the Scout
246
- web interface, to monitor a server.
247
- 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:
248
251
  - test/plugins/disk_usage.rb
249
252
  - test/scout_test.rb