instrumental_tools 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -208,10 +208,10 @@ class SystemInspector
208
208
  end
209
209
 
210
210
  def self.load_disks
211
- { :gauges => disks.merge(diskstats) }
211
+ { :gauges => disk_storage.merge(disk_io) }
212
212
  end
213
213
 
214
- def self.disks
214
+ def self.disk_storage
215
215
  output = {}
216
216
  `df -Pk`.split("\n").grep(%r{^/dev/}).each do |line|
217
217
  device, total, used, available, capacity, mount = line.split(/\s+/)
@@ -227,15 +227,15 @@ class SystemInspector
227
227
  output
228
228
  end
229
229
 
230
- def self.diskstats
231
- entries = `cat /proc/diskstats`.chomp.split("\n").map do |line|
230
+ def self.disk_io
231
+ mounted_devices = `mount`.split("\n").grep(/^\/dev\/(\w+)/) { $1 }
232
+ diskstats_lines = `cat /proc/diskstats`.split("\n").grep(/#{mounted_devices.join('|')}/)
233
+ entries = diskstats_lines.map do |line|
232
234
  values = line.split
233
235
  entry = {}
234
- entry[:time] = Time.now
236
+ entry[:time] = Time.now
235
237
  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]
238
+ entry[:utilization] = values[12].to_f
239
239
  SystemInspector.memory.store("disk_stats_#{entry[:device]}".to_sym, entry)
240
240
  end
241
241
 
@@ -243,10 +243,8 @@ class SystemInspector
243
243
  entries.each do |entry|
244
244
  if previous_entry = SystemInspector.memory.retrieve("disk_stats_#{entry[:device]}".to_sym)
245
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
246
+ utilization_delta = entry[:utilization] - previous_entry[:utilization]
247
+ output["disk.#{entry[:device]}.percent_utilization"] = utilization_delta / time_delta * 100
250
248
  end
251
249
  end
252
250
  output
@@ -1,5 +1,5 @@
1
1
  module Instrumental
2
2
  module Tools
3
- VERSION = "0.4.1"
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,10 +1,15 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: instrumental_tools
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 2
10
+ version: 0.4.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Elijah Miller
9
14
  - Christopher Zelenak
10
15
  - Kristopher Chambers
@@ -12,62 +17,80 @@ authors:
12
17
  autorequire:
13
18
  bindir: bin
14
19
  cert_chain: []
15
- date: 2012-01-11 00:00:00.000000000 Z
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
20
+
21
+ date: 2012-01-12 00:00:00 Z
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
18
24
  name: json
19
- requirement: &70127299346760 !ruby/object:Gem::Requirement
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
20
27
  none: false
21
- requirements:
22
- - - ! '>='
23
- - !ruby/object:Gem::Version
24
- version: '0'
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
25
35
  type: :runtime
26
- prerelease: false
27
- version_requirements: *70127299346760
28
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
29
38
  name: instrumental_agent
30
- requirement: &70127299344700 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
31
41
  none: false
32
- requirements:
33
- - - ! '>='
34
- - !ruby/object:Gem::Version
35
- version: '0.5'
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 1
46
+ segments:
47
+ - 0
48
+ - 5
49
+ version: "0.5"
36
50
  type: :runtime
37
- prerelease: false
38
- version_requirements: *70127299344700
39
- - !ruby/object:Gem::Dependency
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
40
53
  name: pidly
41
- requirement: &70127299342960 !ruby/object:Gem::Requirement
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
42
56
  none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 29
61
+ segments:
62
+ - 0
63
+ - 1
64
+ - 3
46
65
  version: 0.1.3
47
66
  type: :runtime
48
- prerelease: false
49
- version_requirements: *70127299342960
50
- - !ruby/object:Gem::Dependency
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
51
69
  name: rake
52
- requirement: &70127299357440 !ruby/object:Gem::Requirement
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
53
72
  none: false
54
- requirements:
55
- - - ! '>='
56
- - !ruby/object:Gem::Version
57
- version: '0'
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
58
80
  type: :development
59
- prerelease: false
60
- version_requirements: *70127299357440
81
+ version_requirements: *id004
61
82
  description: Tools for displaying information from and reporting to Instrumental (instrumentalapp.com)
62
- email:
83
+ email:
63
84
  - support@instrumentalapp.com
64
- executables:
85
+ executables:
65
86
  - gitstrumental
66
87
  - instrument_server
67
88
  - instrumental
68
89
  extensions: []
90
+
69
91
  extra_rdoc_files: []
70
- files:
92
+
93
+ files:
71
94
  - .gitignore
72
95
  - Gemfile
73
96
  - README.md
@@ -80,26 +103,36 @@ files:
80
103
  - lib/instrumental_tools/version.rb
81
104
  homepage: http://github.com/fastestforward/instrumental_tools
82
105
  licenses: []
106
+
83
107
  post_install_message:
84
108
  rdoc_options: []
85
- require_paths:
109
+
110
+ require_paths:
86
111
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
112
+ required_ruby_version: !ruby/object:Gem::Requirement
88
113
  none: false
89
- requirements:
90
- - - ! '>='
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- required_rubygems_version: !ruby/object:Gem::Requirement
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
94
122
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 3
127
+ segments:
128
+ - 0
129
+ version: "0"
99
130
  requirements: []
131
+
100
132
  rubyforge_project:
101
- rubygems_version: 1.8.13
133
+ rubygems_version: 1.8.10
102
134
  signing_key:
103
135
  specification_version: 3
104
136
  summary: Command line tools for Instrumental
105
137
  test_files: []
138
+