scout 5.6.0.alpha.4 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +22 -29
- data/lib/scout/command/install.rb +2 -5
- data/lib/scout/command/run.rb +17 -5
- data/lib/scout/server.rb +1 -1
- data/lib/scout/server_base.rb +1 -1
- data/lib/scout/version.rb +1 -1
- data/test/scout_test.rb +12 -8
- metadata +4 -4
data/README.markdown
CHANGED
@@ -4,58 +4,51 @@
|
|
4
4
|
|
5
5
|
## Installing
|
6
6
|
|
7
|
-
|
7
|
+
Scout requires Ruby, and is installed via Ruby Gems:
|
8
8
|
|
9
9
|
$ gem install scout
|
10
10
|
|
11
|
-
Then simply run:
|
12
11
|
|
13
|
-
|
12
|
+
## First run from the command line:
|
14
13
|
|
15
|
-
|
14
|
+
$ scout KEY
|
16
15
|
|
17
|
-
|
16
|
+
`KEY` is the identification key assigned by your account at http://scoutapp.com. When run from the command line, scout should print "success." If not, run in verbose mode to see what the problem is:
|
18
17
|
|
19
|
-
|
18
|
+
$ scout KEY -v
|
20
19
|
|
21
|
-
Normal checkin with server:
|
22
20
|
|
23
|
-
|
21
|
+
## Scout is normally run through cron
|
24
22
|
|
25
|
-
|
23
|
+
After you've successfully run Scout from the command line, you should configure it to run every minute via cron. This is how Scout is designed to run on an ongoing basis. Your contab will typically look like this:
|
26
24
|
|
27
|
-
|
25
|
+
* * * * * deploy /usr/bin/scout KEY
|
28
26
|
|
29
|
-
|
30
|
-
$ scout [OPTIONS] install
|
31
|
-
|
32
|
-
Local plugin testing:
|
27
|
+
... assuming you are using the global crontab, and "deploy" is the user running Scout.
|
33
28
|
|
34
|
-
$ scout [OPTIONS] test PATH_TO_PLUGIN [PLUGIN_OPTIONS]
|
35
29
|
|
36
|
-
|
30
|
+
## For a full list of options:
|
37
31
|
|
38
|
-
|
32
|
+
$ scout --help
|
39
33
|
|
40
|
-
|
41
|
-
|
42
|
-
These options will be used for the plugin run. [Lean more about creating your own plugins](https://scoutapp.com/info/creating_a_plugin).
|
34
|
+
## Troubleshooting
|
43
35
|
|
44
|
-
|
36
|
+
The `scout troubleshoot` command provides useful troubleshooting information (log of the last run, environment information, and the list of gems).
|
45
37
|
|
46
|
-
|
38
|
+
Extensive help is available via our website (http://scoutapp.com) and while installing the agent via the Scout web UI.
|
47
39
|
|
48
|
-
## Setting up in Cron
|
49
40
|
|
50
|
-
|
41
|
+
## Local plugin testing:
|
51
42
|
|
52
|
-
|
53
|
-
|
54
|
-
## Troubleshooting
|
43
|
+
$ scout [OPTIONS] test PATH_TO_PLUGIN [PLUGIN_OPTIONS]
|
55
44
|
|
56
|
-
|
45
|
+
`PATH_TO_PLUGIN` is the file system path to a Ruby file that contains a Scout plugin.
|
57
46
|
|
58
|
-
|
47
|
+
`PLUGIN_OPTIONS` are one or more options in the form:
|
48
|
+
|
49
|
+
key1=val1 key2=val2
|
50
|
+
|
51
|
+
These options will be used for the plugin run. [Lean more about creating your own plugins](https://scoutapp.com/info/creating_a_plugin).
|
59
52
|
|
60
53
|
## Credits / Contact
|
61
54
|
|
@@ -11,12 +11,9 @@ module Scout
|
|
11
11
|
puts <<-END_INTRO.gsub(/^ {8}/, "")
|
12
12
|
=== Scout Installation Wizard ===
|
13
13
|
|
14
|
-
You need the
|
15
|
-
It looks like:
|
14
|
+
You need the 40-character alphanumeric key displayed on the account page.
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
Enter the Server Key:
|
16
|
+
Enter the Key:
|
20
17
|
END_INTRO
|
21
18
|
key = gets.to_s.strip
|
22
19
|
|
data/lib/scout/command/run.rb
CHANGED
@@ -17,8 +17,13 @@ module Scout
|
|
17
17
|
log.info "Sleeping #{@scout.sleep_interval} sec" if log
|
18
18
|
sleep @scout.sleep_interval
|
19
19
|
end
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
begin
|
22
|
+
@scout.fetch_plan
|
23
|
+
rescue SystemExit => e
|
24
|
+
puts "Failure. Run with '-v -ldebug' for more information" if $stdin.tty?
|
25
|
+
raise e
|
26
|
+
end
|
22
27
|
|
23
28
|
# Spawn or stop streamer as needed
|
24
29
|
if @scout.streamer_command.is_a?(String)
|
@@ -40,9 +45,16 @@ module Scout
|
|
40
45
|
elsif @force
|
41
46
|
log.info("overriding checkin schedule with --force and checking in now.") if log
|
42
47
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
48
|
+
|
49
|
+
begin
|
50
|
+
create_pid_file_or_exit
|
51
|
+
@scout.run_plugins_by_plan
|
52
|
+
@scout.save_history
|
53
|
+
puts "Successfully reported to #{server}" if $stdin.tty?
|
54
|
+
rescue SystemExit => e
|
55
|
+
puts "Failure. Run with '-v -ldebug' for more information" if $stdin.tty?
|
56
|
+
raise e
|
57
|
+
end
|
46
58
|
|
47
59
|
begin
|
48
60
|
# Since this is a new checkin, overwrite the existing log
|
data/lib/scout/server.rb
CHANGED
@@ -60,7 +60,7 @@ module Scout
|
|
60
60
|
def refresh?
|
61
61
|
return true if !ping_key or account_public_key_changed? # fetch the plan again if the account key is modified/created
|
62
62
|
|
63
|
-
url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&
|
63
|
+
url=URI.join( @server.sub("https://","http://"), "/clients/#{ping_key}/ping.scout?roles=#{@roles}&hostname=#{Socket.gethostname}")
|
64
64
|
|
65
65
|
headers = {"x-scout-tty" => ($stdin.tty? ? 'true' : 'false')}
|
66
66
|
if @history["plan_last_modified"] and @history["old_plugins"]
|
data/lib/scout/server_base.rb
CHANGED
@@ -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}&
|
32
|
+
"?roles=#{@roles}&hostname=#{Socket.gethostname}&tty=#{$stdin.tty? ? 'y' : 'n'}")
|
33
33
|
end
|
34
34
|
|
35
35
|
def post(url, error, body, headers = Hash.new, &response_handler)
|
data/lib/scout/version.rb
CHANGED
data/test/scout_test.rb
CHANGED
@@ -29,6 +29,15 @@ AGENT_LOG = File.join AGENT_DIR, 'latest_run.log'
|
|
29
29
|
PLUGINS_PROPERTIES = File.join AGENT_DIR, 'plugins.properties'
|
30
30
|
PATH_TO_TEST_PLUGIN = File.expand_path( File.dirname(__FILE__) ) + '/plugins/temp_plugin.rb'
|
31
31
|
|
32
|
+
|
33
|
+
# This is a super simple shim to provide the two methods we use in delayed_job's API:
|
34
|
+
# some_ar_instance.delay.some_method, and some_ar_class.delay.some_class_method
|
35
|
+
class ActiveRecord::Base
|
36
|
+
def delay; self; end
|
37
|
+
def self.delay; self; end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
32
41
|
class ScoutTest < Test::Unit::TestCase
|
33
42
|
def setup
|
34
43
|
load_fixtures :clients, :accounts, :plugins, :subscriptions, :plugin_metas, :roles, :plugin_definitions, :notification_groups
|
@@ -58,7 +67,7 @@ class ScoutTest < Test::Unit::TestCase
|
|
58
67
|
res=""
|
59
68
|
PTY.spawn("bin/scout -s http://localhost:4567 -d #{PATH_TO_DATA_FILE} install ") do | stdin, stdout, pid |
|
60
69
|
begin
|
61
|
-
stdin.expect("Enter the
|
70
|
+
stdin.expect("Enter the Key:", 3) do |response|
|
62
71
|
assert_not_nil response, "Agent didn't print prompt for server key"
|
63
72
|
stdout.puts @client.key # feed the agent the key
|
64
73
|
res=stdin.read.lstrip
|
@@ -557,12 +566,6 @@ mybar=100
|
|
557
566
|
assert @db_role.plugin_definitions.include?(plugin.plugin_definition), "#{plugin} should be included in the db role"
|
558
567
|
end
|
559
568
|
|
560
|
-
# 4th checking -- remove all roles
|
561
|
-
exec_scout(@roles_account.key, "--force")
|
562
|
-
client=@roles_account.clients.last
|
563
|
-
assert_equal 1, client.roles.count
|
564
|
-
assert_equal 0, client.plugins.count
|
565
|
-
|
566
569
|
end
|
567
570
|
|
568
571
|
######################
|
@@ -580,7 +583,7 @@ mybar=100
|
|
580
583
|
end
|
581
584
|
|
582
585
|
# Runs the scout command with the given +key+ and options. Returns output from the latest run.
|
583
|
-
# Example: scout(KEY,'-F', '-v -l debug').
|
586
|
+
# Example: scout(KEY,'-F', '-v', '-l', 'debug').
|
584
587
|
#
|
585
588
|
# Notes:
|
586
589
|
# * This runs Scout in the test process - it means exit handlers and spawning processes (for streaming) can't
|
@@ -595,6 +598,7 @@ mybar=100
|
|
595
598
|
args += ['-s','http://localhost:4567']
|
596
599
|
args += ['-d', PATH_TO_DATA_FILE]
|
597
600
|
args += opts if opts.any?
|
601
|
+
# args += ['-v', '-l', 'debug'] # if you want to debug
|
598
602
|
Scout::Command.dispatch(args)
|
599
603
|
File.read(AGENT_LOG) if File.exist?(AGENT_LOG)
|
600
604
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.6.0
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andre Lewis
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date:
|
14
|
+
date: 2013-02-05 00:00:00 -08:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -236,9 +236,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
236
|
version:
|
237
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
238
|
requirements:
|
239
|
-
- - "
|
239
|
+
- - ">="
|
240
240
|
- !ruby/object:Gem::Version
|
241
|
-
version:
|
241
|
+
version: "0"
|
242
242
|
version:
|
243
243
|
requirements: []
|
244
244
|
|