graphiterb 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/graphiterb.gemspec +1 -1
- data/lib/graphiterb/monitors/system.rb +13 -7
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/graphiterb.gemspec
CHANGED
@@ -33,25 +33,31 @@ module Graphiterb
|
|
33
33
|
|
34
34
|
def memory lines
|
35
35
|
lines.each do |line|
|
36
|
-
next unless line =~ /^Mem:
|
37
|
-
|
36
|
+
next unless line =~ /^Mem: *(\d+)k *total, *(\d+)k *used, *(\d+)k *free/
|
37
|
+
total = $1.to_f
|
38
|
+
return [$2, $3].map do |bytes|
|
39
|
+
bytes.to_f / total rescue 0.0
|
40
|
+
end
|
38
41
|
end
|
39
42
|
[0,0]
|
40
43
|
end
|
41
44
|
|
42
45
|
def swap lines
|
43
46
|
lines.each do |line|
|
44
|
-
next unless line =~ /^Swap:
|
45
|
-
|
47
|
+
next unless line =~ /^Swap: *(\d+)k *total, *(\d+)k *used, *(\d+)k *free/
|
48
|
+
total = $1.to_f
|
49
|
+
return [$2, $3].map do |bytes|
|
50
|
+
bytes.to_f / total rescue 0.0
|
51
|
+
end
|
46
52
|
end
|
47
53
|
[0,0]
|
48
54
|
end
|
49
55
|
|
50
|
-
|
51
56
|
def get_metrics metrics, since
|
52
|
-
df.each do |handle, size, spaceused, spacefree,
|
57
|
+
df.each do |handle, size, spaceused, spacefree, percentused, location|
|
53
58
|
disk_name = handle.gsub(/^\//, '').split('/')
|
54
|
-
|
59
|
+
percent_free = (100.0 * spaceused.to_f / (spaceused.to_f + spacefree.to_f)) rescue 0.0
|
60
|
+
metrics << [scope(hostname, disk_name, 'available'), percent_free]
|
55
61
|
end
|
56
62
|
|
57
63
|
lines = top
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiterb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philip (flip) Kromer (@mrflip)
|