scout 5.5.8.pre → 5.5.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,6 +1,7 @@
1
- # 5.5.8.pre
1
+ # 5.5.8
2
2
 
3
3
  * Passing server_name for install + test commands so https_proxy is used.
4
+ * Resetting history file when then client key changes
4
5
 
5
6
  # 5.5.7
6
7
 
data/README.markdown CHANGED
@@ -22,38 +22,39 @@ Normal checkin with server:
22
22
 
23
23
  $ scout [OPTIONS] SERVER_KEY
24
24
 
25
+ `SERVER_KEY` is the identification key assigned by your account at http://scoutapp.com.
26
+
25
27
  Install:
26
28
 
27
29
  $ scout
28
30
  $ scout [OPTIONS] install
29
-
31
+
30
32
  Local plugin testing:
31
33
 
32
34
  $ scout [OPTIONS] test PATH_TO_PLUGIN [PLUGIN_OPTIONS]
33
35
 
34
-
35
- `SERVER_KEY` is the identification key assigned by your account at http://scoutapp.com.
36
-
37
36
  `PATH_TO_PLUGIN` is the file system path to a Ruby file that contains a Scout plugin.
38
37
 
39
38
  `PLUGIN_OPTIONS` are one or more options in the form:
40
39
 
41
40
  key1=val1 key2=val2
42
41
 
43
- These options will be used for the plugin run.
42
+ These options will be used for the plugin run. [Lean more about creating your own plugins](https://scoutapp.com/info/creating_a_plugin).
43
+
44
+ For a full list of options:
45
+
46
+ scout --help
44
47
 
45
48
  ## Setting up in Cron
46
49
 
47
50
  Configure Scout to run every minute. Typically, this will look like:
48
51
 
49
52
  * * * * * deploy /usr/bin/scout SERVER_KEY
50
-
51
- It's often helpful to log the output to a file. To do so:
52
-
53
- * * * * * deploy /usr/bin/scout SERVER_KEY > /path/to/anywhere/scout.out 2>&1
54
53
 
55
54
  ## Troubleshooting
56
55
 
56
+ The `scout troubleshoot` command provides useful troubleshooting information (log of the last run, environment information, and the list of gems).
57
+
57
58
  Extensive help is available via our website (http://scoutapp.com) and while installing the agent via the Scout web UI.
58
59
 
59
60
  ## Credits / Contact
data/lib/scout/server.rb CHANGED
@@ -24,6 +24,7 @@ module Scout
24
24
  attr_reader :directives
25
25
  attr_reader :plugin_config
26
26
  attr_reader :streamer_command
27
+ attr_reader :client_key
27
28
 
28
29
  # Creates a new Scout Server connection.
29
30
  def initialize(server, client_key, history_file, logger = nil, server_name=nil, http_proxy='', https_proxy='')
@@ -201,6 +202,27 @@ module Scout
201
202
  (@history['directives'] || {})['ping_key']
202
203
  end
203
204
 
205
+ def client_key_changed?
206
+ last_client_key=@history['last_client_key']
207
+ # last_client_key will be nil on versions <= 5.5.7. when the agent runs after the upgrade, it will no longer
208
+ # be nil. don't want to aggressively reset the history file as it clears out memory values which may impact alerts.
209
+ if last_client_key and client_key != last_client_key
210
+ warn "The key associated with the history file has changed [#{last_client_key}] => [#{client_key}]."
211
+ true
212
+ else
213
+ false
214
+ end
215
+ end
216
+
217
+ # need to load the history file first to determine if the key changed.
218
+ # if it has, reset.
219
+ def recreate_history_if_client_key_changed
220
+ if client_key_changed?
221
+ create_blank_history
222
+ @history = YAML.load(File.read(@history_file))
223
+ end
224
+ end
225
+
204
226
  # Returns the Scout public key for code verification.
205
227
  def scout_public_key
206
228
  return @scout_public_key if instance_variables.include?('@scout_public_key')
@@ -499,6 +521,7 @@ module Scout
499
521
  backup_history_and_recreate(contents,
500
522
  "Couldn't parse the history file. Deleting it and resetting to an empty history file. Keeping a backup.")
501
523
  end
524
+ recreate_history_if_client_key_changed
502
525
  # YAML interprets an empty file as false. This condition catches that
503
526
  if !@history
504
527
  info "There is a problem with the history file at '#{@history_file}'. The root cause is sometimes a full disk. "+
@@ -523,7 +546,7 @@ module Scout
523
546
  def create_blank_history
524
547
  debug "Creating empty history file..."
525
548
  File.open(@history_file, "w") do |file|
526
- YAML.dump({"last_runs" => Hash.new, "memory" => Hash.new}, file)
549
+ YAML.dump({"last_runs" => Hash.new, "memory" => Hash.new, "last_client_key" => client_key}, file)
527
550
  end
528
551
  info "History file created."
529
552
  end
@@ -534,6 +557,7 @@ module Scout
534
557
  # Ensures reads on the history file don't see a partial write.
535
558
  def save_history
536
559
  debug "Saving history file..."
560
+ @history['last_client_key'] = client_key
537
561
  File.open(@history_tmp_file, "w") { |file| YAML.dump(@history, file) }
538
562
  FileUtils.mv(@history_tmp_file, @history_file)
539
563
  info "History file saved."
data/lib/scout/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.5.8.pre"
2
+ VERSION = "5.5.8"
3
3
  end
data/test/scout_test.rb CHANGED
@@ -123,6 +123,18 @@ class ScoutTest < Test::Unit::TestCase
123
123
  scout(@client.key)
124
124
  assert File.read(AGENT_LOG).size > log_file_size, "log should be longer after ping"
125
125
  end
126
+
127
+ def test_should_reset_history_on_key_change
128
+ test_should_run_first_time
129
+ data=YAML::load(File.read(PATH_TO_DATA_FILE))
130
+ assert_equal @client.ping_key, data['directives']['ping_key']
131
+ assert_equal @client.key, data['last_client_key']
132
+ sleep 1
133
+ exec_scout('INVALIDKEY')
134
+ data=YAML::load(File.read(PATH_TO_DATA_FILE))
135
+ assert_equal 'INVALIDKEY', data['last_client_key']
136
+ assert_nil data['directives']
137
+ end
126
138
 
127
139
  def test_should_use_name_option
128
140
  scout(@client.key,'--name=My New Server')
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.5.8.pre
5
- prerelease: 6
4
+ version: 5.5.8
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: 2012-09-05 00:00:00.000000000 Z
14
+ date: 2012-09-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: elif
18
- requirement: &2160671080 !ruby/object:Gem::Requirement
18
+ requirement: &2157721580 !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: *2160671080
26
+ version_requirements: *2157721580
27
27
  description: ! 'Scout makes monitoring and reporting on your web applications as flexible
28
28
  and simple as possible.
29
29
 
@@ -232,9 +232,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  none: false
234
234
  requirements:
235
- - - ! '>'
235
+ - - ! '>='
236
236
  - !ruby/object:Gem::Version
237
- version: 1.3.1
237
+ version: '0'
238
238
  requirements: []
239
239
  rubyforge_project: scout
240
240
  rubygems_version: 1.8.10