panoptimon 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/collectors/disk/disk +35 -20
- data/lib/panoptimon/version.rb +1 -1
- data/panoptimon.gemspec +0 -3
- metadata +40 -26
- data/collectors/disk/requires +0 -1
data/CHANGELOG.md
CHANGED
data/collectors/disk/disk
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'json'
|
4
4
|
require 'rubygems'
|
5
|
-
require '
|
5
|
+
require 'ostruct'
|
6
6
|
|
7
7
|
config = JSON::parse(ARGV[0])
|
8
8
|
|
@@ -10,26 +10,41 @@ $stdout.sync = true
|
|
10
10
|
|
11
11
|
def GB b; (b.to_f / 1024**3).round(6); end # GB significant down to 4kB
|
12
12
|
|
13
|
+
def get_mounts
|
14
|
+
mount_hash = {}
|
15
|
+
mounts = File.open("/etc/mtab", "r").read.split("\n").map{|l| l.split(/\s+/)}
|
16
|
+
mounts.each{|m| mount_hash[m[1]] = m[0] unless %w[devpts udev sysfs tmpfs none proc].include?(m[0])}
|
17
|
+
mount_hash
|
18
|
+
end
|
19
|
+
|
20
|
+
def stat_fs (mounts)
|
21
|
+
s = %x[stat --printf="%n %s %b %f %a %c %d\n" -f #{mounts.keys.join(' ')}].split("\n")
|
22
|
+
s.map!{|l| l.split}
|
23
|
+
s.map{|l|
|
24
|
+
OpenStruct.new(
|
25
|
+
name: mounts[l[0]],
|
26
|
+
block_size: l[1].to_i,
|
27
|
+
blocks: l[2].to_i,
|
28
|
+
blocks_free: l[3].to_i,
|
29
|
+
blocks_available: l[4].to_i,
|
30
|
+
files: l[5].to_i,
|
31
|
+
files_available: l[6].to_i
|
32
|
+
).freeze
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
13
36
|
while(true) do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
s
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
space_used: GB((s.blocks - s.blocks_free) * s.block_size),
|
26
|
-
space_free: GB(s.blocks_available * s.block_size),
|
27
|
-
space_priv: GB((s.blocks_free - s.blocks_available) * s.block_size),
|
28
|
-
files_used: s.files - s.files_available,
|
29
|
-
files_free: s.files_available,
|
30
|
-
# files_priv: s.files_free - s.files_available, # XXX any use?
|
31
|
-
}]
|
32
|
-
}
|
37
|
+
mounts = get_mounts
|
38
|
+
stats = stat_fs(mounts)
|
39
|
+
info = stats.map{ |s|
|
40
|
+
[s.name, {
|
41
|
+
space_used: GB((s.blocks - s.blocks_free) * s.block_size),
|
42
|
+
space_free: GB(s.blocks_available * s.block_size),
|
43
|
+
space_priv: GB((s.blocks_free - s.blocks_available) * s.block_size),
|
44
|
+
files_used: s.files - s.files_available,
|
45
|
+
files_free: s.files_available,
|
46
|
+
}]
|
47
|
+
}
|
33
48
|
puts JSON::generate(Hash[*info.flatten])
|
34
49
|
|
35
50
|
break unless config.include?('interval')
|
data/lib/panoptimon/version.rb
CHANGED
data/panoptimon.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panoptimon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,32 +21,47 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: daemons
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
|
-
- -
|
35
|
+
- - '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: json
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
|
-
- -
|
51
|
+
- - '>='
|
42
52
|
- !ruby/object:Gem::Version
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: thin
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,29 +69,28 @@ dependencies:
|
|
54
69
|
version: 1.5.0
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.5.0
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: riemann-client
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
|
-
- -
|
83
|
+
- - '>='
|
64
84
|
- !ruby/object:Gem::Version
|
65
85
|
version: '0'
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: sys-filesystem
|
71
|
-
requirement: &11205560 !ruby/object:Gem::Requirement
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
89
|
none: false
|
73
90
|
requirements:
|
74
|
-
- -
|
91
|
+
- - '>='
|
75
92
|
- !ruby/object:Gem::Version
|
76
93
|
version: '0'
|
77
|
-
type: :runtime
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: *11205560
|
80
94
|
description: The All-Seeing System Monitor Daemon
|
81
95
|
email: sysops@sourcefire.com
|
82
96
|
executables:
|
@@ -95,7 +109,6 @@ files:
|
|
95
109
|
- collectors/cpu/cpu.json
|
96
110
|
- collectors/disk/disk
|
97
111
|
- collectors/disk/disk.json
|
98
|
-
- collectors/disk/requires
|
99
112
|
- collectors/disk_free/disk_free
|
100
113
|
- collectors/disk_free/disk_free.json
|
101
114
|
- collectors/dns/README.md
|
@@ -269,18 +282,18 @@ require_paths:
|
|
269
282
|
required_ruby_version: !ruby/object:Gem::Requirement
|
270
283
|
none: false
|
271
284
|
requirements:
|
272
|
-
- -
|
285
|
+
- - '>='
|
273
286
|
- !ruby/object:Gem::Version
|
274
287
|
version: '1.9'
|
275
288
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
289
|
none: false
|
277
290
|
requirements:
|
278
|
-
- -
|
291
|
+
- - '>='
|
279
292
|
- !ruby/object:Gem::Version
|
280
293
|
version: '0'
|
281
294
|
requirements: []
|
282
295
|
rubyforge_project:
|
283
|
-
rubygems_version: 1.8.
|
296
|
+
rubygems_version: 1.8.25
|
284
297
|
signing_key:
|
285
298
|
specification_version: 3
|
286
299
|
summary: Panoptimon collects and routes system metrics.
|
@@ -291,3 +304,4 @@ test_files:
|
|
291
304
|
- spec/collector/metric_spec.rb
|
292
305
|
- spec/passthru_spec.rb
|
293
306
|
- spec/util_spec.rb
|
307
|
+
has_rdoc:
|
data/collectors/disk/requires
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
gem/sys-filesystem
|