server_metrics 0.0.8.3 → 0.0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/server_metrics/collectors/cpu.rb +6 -3
- data/lib/server_metrics/version.rb +1 -1
- data/test/test_with_fixtures.rb +0 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "time"
|
2
|
+
require 'server_metrics/system_info'
|
2
3
|
|
3
4
|
class ServerMetrics::Cpu < ServerMetrics::Collector
|
4
5
|
|
@@ -25,9 +26,11 @@ class ServerMetrics::Cpu < ServerMetrics::Collector
|
|
25
26
|
uptime_output = `uptime`
|
26
27
|
matches = uptime_output.match(/load averages?: ([\d.]+),? ([\d.]+),? ([\d.]+)\Z/)
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
number_of_processors = ServerMetrics::SystemInfo.num_processors
|
30
|
+
|
31
|
+
report(:last_minute => matches[1].to_f / number_of_processors,
|
32
|
+
:last_five_minutes => matches[2].to_f / number_of_processors,
|
33
|
+
:last_fifteen_minutes => matches[3].to_f / number_of_processors)
|
31
34
|
end
|
32
35
|
|
33
36
|
# Helper class
|
data/test/test_with_fixtures.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: server_metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.8.
|
4
|
+
version: 0.0.8.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sys-proctable
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
segments:
|
174
174
|
- 0
|
175
|
-
hash:
|
175
|
+
hash: 3571060902029865156
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 3571060902029865156
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
187
|
rubygems_version: 1.8.25
|