instrumental_tools 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # Instrumental Tools
2
2
 
3
- A collection of scripts useful in monitoring servers and services with Instrumental ([www.instrumentalapp.com](http://www.instrumentalapp.com/)).
3
+ A collection of scripts useful for monitoring servers and services with Instrumental ([www.instrumentalapp.com](http://www.instrumentalapp.com/)).
4
4
 
5
5
  ## instrument_server
6
6
 
7
- Use to monitor server activity by collecting information on CPU and memory usage, disk IO, filesystem usage, etc. Execute with:
7
+ Monitor server activity by collecting information on CPU and memory usage, disk IO, filesystem usage, etc.
8
+
9
+ Basic usage:
8
10
 
9
11
  ```sh
10
12
  instrument_server -k <API_KEY>
@@ -12,23 +14,29 @@ instrument_server -k <API_KEY>
12
14
 
13
15
  The API key can also be provided by setting the INSTRUMENTAL_TOKEN environment variable, which eliminates the need to supply the key via command line option.
14
16
 
15
- NOTE for Mac OS users: Due to a bug in Ruby, instrument_server can occasionally deadlock ([bug report](http://bugs.ruby-lang.org/issues/5811)).
17
+ By default, instrument_server will use the hostname of the current host when reporting metrics, e.g. 'hostname.cpu.in_use'. To specify a different hostname:
16
18
 
17
- ## instrumental
19
+ ```sh
20
+ instrument_server -k <API_KEY> -H <HOSTNAME>
21
+ ```
18
22
 
19
- Output text graphs of the different metrics in your project.
23
+ ### Running as a Daemon
20
24
 
21
- See all options with: `instrumental --help`
25
+ To start instrument_server as a daemon:
22
26
 
23
- ## gitstrumental
27
+ ```
28
+ instrument_server -k <API_KEY> -d
29
+ ```
24
30
 
25
- Collect statistics on commit counts in a given git repo. Execute in the repo directory with:
31
+ While the -d flag alone is sufficient for starting instrument_server as a daemon, use of additional parameters allows interaction with the running daemon process:
32
+
33
+ * start, stop, restart - run, halt, or restart the daemon
34
+ * status - display daemon status (running, stopped)
35
+ * clean - remove any files created by the daemon
36
+ * kill - forcibly halt the daemon and remove its pid file
26
37
 
27
- ```sh
28
- gitstrumental [API_KEY]
29
- ```
30
38
 
31
- ## Capistrano Integration
39
+ ### Capistrano Integration
32
40
 
33
41
  Add `require "instrumental_tools/capistrano"` to your capistrano
34
42
  configuration and instrument_server will be restarted after your
@@ -54,3 +62,16 @@ something like this in your capistrano configuration:
54
62
  ```ruby
55
63
  namespaces[:instrumental].tasks[:restart_instrument_server].options[:roles] = [:web, :worker]
56
64
  ```
65
+
66
+ ### NOTEs
67
+
68
+ Mac OS users: Due to a bug in Ruby, instrument_server can occasionally deadlock ([bug report](http://bugs.ruby-lang.org/issues/5811)).
69
+
70
+ ## gitstrumental
71
+
72
+ Collect commit counts from git repositories:
73
+
74
+ ```sh
75
+ cd project_directory
76
+ gitstrumental <API_KEY>
77
+ ```
data/bin/gitstrumental CHANGED
@@ -6,7 +6,7 @@ require 'instrumental_agent'
6
6
  token = ENV["INSTRUMENTAL_TOKEN"] || ARGV[0]
7
7
 
8
8
  if !token
9
- puts 'Usage: gitstrumental API_TOKEN'
9
+ puts 'Usage: gitstrumental API_KEY'
10
10
  exit 1
11
11
  end
12
12
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.email = ["support@instrumentalapp.com"]
9
9
  s.homepage = "http://github.com/fastestforward/instrumental_tools"
10
10
  s.summary = %q{Command line tools for Instrumental}
11
- s.description = %q{Tools for displaying information from and reporting to Instrumental (instrumentalapp.com)}
11
+ s.description = %q{A collection of scripts useful for monitoring servers and services with Instrumental (instrumentalapp.com)}
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,5 +1,5 @@
1
1
  module Instrumental
2
2
  module Tools
3
- VERSION = '0.4.2'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,10 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: instrumental_tools
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 2
10
- version: 0.4.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Elijah Miller
14
9
  - Christopher Zelenak
15
10
  - Kristopher Chambers
@@ -17,122 +12,93 @@ authors:
17
12
  autorequire:
18
13
  bindir: bin
19
14
  cert_chain: []
20
-
21
- date: 2012-01-12 00:00:00 Z
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
15
+ date: 2012-01-16 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
24
18
  name: json
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
19
+ requirement: &70357022830140 !ruby/object:Gem::Requirement
27
20
  none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- version: "0"
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
35
25
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: instrumental_agent
39
26
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ version_requirements: *70357022830140
28
+ - !ruby/object:Gem::Dependency
29
+ name: instrumental_agent
30
+ requirement: &70357022829620 !ruby/object:Gem::Requirement
41
31
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 1
46
- segments:
47
- - 0
48
- - 5
49
- version: "0.5"
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0.5'
50
36
  type: :runtime
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: pidly
54
37
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ version_requirements: *70357022829620
39
+ - !ruby/object:Gem::Dependency
40
+ name: pidly
41
+ requirement: &70357022829140 !ruby/object:Gem::Requirement
56
42
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 29
61
- segments:
62
- - 0
63
- - 1
64
- - 3
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
65
46
  version: 0.1.3
66
47
  type: :runtime
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rake
70
48
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ version_requirements: *70357022829140
50
+ - !ruby/object:Gem::Dependency
51
+ name: rake
52
+ requirement: &70357022828660 !ruby/object:Gem::Requirement
72
53
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
80
58
  type: :development
81
- version_requirements: *id004
82
- description: Tools for displaying information from and reporting to Instrumental (instrumentalapp.com)
83
- email:
59
+ prerelease: false
60
+ version_requirements: *70357022828660
61
+ description: A collection of scripts useful for monitoring servers and services with
62
+ Instrumental (instrumentalapp.com)
63
+ email:
84
64
  - support@instrumentalapp.com
85
- executables:
65
+ executables:
86
66
  - gitstrumental
87
67
  - instrument_server
88
- - instrumental
89
68
  extensions: []
90
-
91
69
  extra_rdoc_files: []
92
-
93
- files:
70
+ files:
94
71
  - .gitignore
95
72
  - Gemfile
96
73
  - README.md
97
74
  - Rakefile
98
75
  - bin/gitstrumental
99
76
  - bin/instrument_server
100
- - bin/instrumental
101
77
  - instrumental_tools.gemspec
102
78
  - lib/instrumental_tools/capistrano.rb
103
79
  - lib/instrumental_tools/version.rb
104
80
  homepage: http://github.com/fastestforward/instrumental_tools
105
81
  licenses: []
106
-
107
82
  post_install_message:
108
83
  rdoc_options: []
109
-
110
- require_paths:
84
+ require_paths:
111
85
  - lib
112
- required_ruby_version: !ruby/object:Gem::Requirement
86
+ required_ruby_version: !ruby/object:Gem::Requirement
113
87
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
119
- - 0
120
- version: "0"
121
- required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
93
  none: false
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- hash: 3
127
- segments:
128
- - 0
129
- version: "0"
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
130
98
  requirements: []
131
-
132
99
  rubyforge_project:
133
- rubygems_version: 1.8.10
100
+ rubygems_version: 1.8.13
134
101
  signing_key:
135
102
  specification_version: 3
136
103
  summary: Command line tools for Instrumental
137
104
  test_files: []
138
-
data/bin/instrumental DELETED
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'cgi'
3
- require 'net/http'
4
- require 'optparse'
5
- require 'rubygems'
6
- gem 'json'
7
- require 'json'
8
-
9
-
10
- metrics = "*"
11
- token = ENV["INSTRUMENTAL_TOKEN"]
12
- allowed_durations = [1800, 3600, 10800, 21600, 43200, 86400, 259200, 604800, 1209600]
13
- duration = nil
14
-
15
- opts = OptionParser.new do |opts|
16
- opts.banner = "Usage: instrumental [options]"
17
-
18
- opts.on("-m", "--metrics METRICS", "Comma separated list of metrics you're interested in. Wildcard (*) allowed") do |m|
19
- metrics = m
20
- end
21
-
22
- opts.on("-t", "--token TOKEN", "Your API token. Also can be set as an environment variable, INSTRUMENTAL_TOKEN") do |t|
23
- token = t
24
- end
25
-
26
- opts.on("-d", "--duration DURATION", "Duration ago in seconds to view. You can specify #{allowed_durations.join(" ")}") do |d|
27
- duration = allowed_durations.index(d.to_i) && d.to_i
28
- end
29
- end.parse!
30
-
31
- search_line = CGI.escape(metrics)
32
- duration &&= "&duration=#{duration}"
33
- http = Net::HTTP.new("instrumentalapp.com", 80)
34
- request = Net::HTTP::Get.new("/metrics/#{search_line}?token=#{token}&format=json#{duration}")
35
- response = http.request(request)
36
- raise "Server error: #{response.message} #{response.code}" if response.code.to_i != 200
37
- response = JSON.parse(response.body)
38
- bars = ["\342\226\201", "\342\226\202", "\342\226\203", "\342\226\204", "\342\226\205", "\342\226\206", "\342\226\207"]
39
- max_key_size = response.collect { |k, v| k.size }.max
40
- scale = bars.size - 1
41
- response.each do |metric, data|
42
- data = data.collect { |h| h["value"].to_f }
43
- min = data.min
44
- range = data.max - min
45
- graph = data.collect do |v|
46
- if (idx = (((v - min) / range) * scale)).nan?
47
- idx = 0
48
- elsif idx.infinite?
49
- idx = scale
50
- end
51
- bars[idx.round]
52
- end
53
- puts "%#{max_key_size}s | %s" % [metric, graph.join]
54
- end