instrumental_tools 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -2
- data/bin/instrument_server +20 -17
- data/lib/instrumental_tools/version.rb +1 -1
- metadata +15 -15
data/README.md
CHANGED
@@ -10,8 +10,6 @@ Use to collect various monitoring statistics of a server. Execute with:
|
|
10
10
|
instrument_server -k <INSTRUMENTAL_API_KEY>
|
11
11
|
```
|
12
12
|
|
13
|
-
Linux note: Install iostat (part of the sysstat package) in order to collect disk I/O metrics.
|
14
|
-
|
15
13
|
Mac OS note: Due to a bug in Ruby, instrument_server can occasionally deadlock ([bug report](http://bugs.ruby-lang.org/issues/5811)).
|
16
14
|
|
17
15
|
## instrumental
|
data/bin/instrument_server
CHANGED
@@ -208,7 +208,7 @@ class SystemInspector
|
|
208
208
|
end
|
209
209
|
|
210
210
|
def self.load_disks
|
211
|
-
{ :gauges => disks.merge(
|
211
|
+
{ :gauges => disks.merge(diskstats) }
|
212
212
|
end
|
213
213
|
|
214
214
|
def self.disks
|
@@ -227,16 +227,26 @@ class SystemInspector
|
|
227
227
|
output
|
228
228
|
end
|
229
229
|
|
230
|
-
def self.
|
230
|
+
def self.diskstats
|
231
|
+
entries = `cat /proc/diskstats`.chomp.split("\n").map do |line|
|
232
|
+
values = line.split
|
233
|
+
entry = {}
|
234
|
+
entry[:time] = Time.now
|
235
|
+
entry[:device] = values[2]
|
236
|
+
entry[:read] = values[6].to_f
|
237
|
+
entry[:write] = values[10].to_f
|
238
|
+
entry[:io] = entry[:read] + entry[:write]
|
239
|
+
SystemInspector.memory.store("disk_stats_#{entry[:device]}".to_sym, entry)
|
240
|
+
end
|
241
|
+
|
231
242
|
output = {}
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
output["disk.#{values[0]}.percent_utilization"] = values[util_index].to_f
|
243
|
+
entries.each do |entry|
|
244
|
+
if previous_entry = SystemInspector.memory.retrieve("disk_stats_#{entry[:device]}".to_sym)
|
245
|
+
time_delta = (entry[:time] - previous_entry[:time]) * 1000
|
246
|
+
[:read, :write, :io].each do |type|
|
247
|
+
utilization_delta = entry[type] - previous_entry[type]
|
248
|
+
output["disk.#{entry[:device]}.#{type}_utilization"] = utilization_delta / time_delta * 100
|
249
|
+
end
|
240
250
|
end
|
241
251
|
end
|
242
252
|
output
|
@@ -327,12 +337,6 @@ class ServerController < Pidly::Control
|
|
327
337
|
alias_method :clean, :clean!
|
328
338
|
end
|
329
339
|
|
330
|
-
def terminal_messages
|
331
|
-
if `which iostat`.chomp.empty?
|
332
|
-
puts 'Install iostat (sysstat package) to collect disk I/O metrics.'
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
340
|
def require_api_key(options, parser)
|
337
341
|
unless options[:api_key] # present?
|
338
342
|
print parser.help
|
@@ -365,7 +369,6 @@ option_parser = OptionParser.new do |opts|
|
|
365
369
|
end
|
366
370
|
opts.on('-h', '--help', 'Display this screen') do
|
367
371
|
puts opts
|
368
|
-
terminal_messages
|
369
372
|
exit
|
370
373
|
end
|
371
374
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instrumental_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Elijah Miller
|
@@ -21,7 +21,8 @@ cert_chain: []
|
|
21
21
|
date: 2012-01-11 00:00:00 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
24
|
+
name: json
|
25
|
+
prerelease: false
|
25
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
27
|
none: false
|
27
28
|
requirements:
|
@@ -31,11 +32,11 @@ dependencies:
|
|
31
32
|
segments:
|
32
33
|
- 0
|
33
34
|
version: "0"
|
34
|
-
|
35
|
+
type: :runtime
|
35
36
|
version_requirements: *id001
|
36
|
-
prerelease: false
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
38
|
+
name: instrumental_agent
|
39
|
+
prerelease: false
|
39
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
41
42
|
requirements:
|
@@ -46,11 +47,11 @@ dependencies:
|
|
46
47
|
- 0
|
47
48
|
- 5
|
48
49
|
version: "0.5"
|
49
|
-
|
50
|
+
type: :runtime
|
50
51
|
version_requirements: *id002
|
51
|
-
prerelease: false
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
|
-
|
53
|
+
name: pidly
|
54
|
+
prerelease: false
|
54
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
56
|
none: false
|
56
57
|
requirements:
|
@@ -62,11 +63,11 @@ dependencies:
|
|
62
63
|
- 1
|
63
64
|
- 3
|
64
65
|
version: 0.1.3
|
65
|
-
|
66
|
+
type: :runtime
|
66
67
|
version_requirements: *id003
|
67
|
-
prerelease: false
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
|
69
|
+
name: rake
|
70
|
+
prerelease: false
|
70
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
72
|
none: false
|
72
73
|
requirements:
|
@@ -76,9 +77,8 @@ dependencies:
|
|
76
77
|
segments:
|
77
78
|
- 0
|
78
79
|
version: "0"
|
79
|
-
|
80
|
+
type: :development
|
80
81
|
version_requirements: *id004
|
81
|
-
prerelease: false
|
82
82
|
description: Tools for displaying information from and reporting to Instrumental (instrumentalapp.com)
|
83
83
|
email:
|
84
84
|
- support@instrumentalapp.com
|