ffwd-collectd 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ffwd/plugin/collectd/connection.rb +16 -15
- data/lib/ffwd/plugin/collectd/version.rb +1 -1
- data/lib/ffwd/plugin/collectd.rb +3 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8d614177f14e30bb8d304dceed417a525263909
|
4
|
+
data.tar.gz: 098d8eaa876fd78cd41a674526be5ef635cc7f41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aca02b9d2d7053d2ec4199ebaeaeb0e185e01245b623cf7685f8958f1c423a8c3c35be4932376b16559cc797c3b82b41ee1a1a202b228d4faad246ba09b2dbe
|
7
|
+
data.tar.gz: d5231c5863a03806f9e370bca0b84d9c4aa068508ff118b0842e965fb14d1608a93e9f01916896e7d17d73fc1db603574d07383805dcfb5081653fdf0f807b07
|
@@ -24,49 +24,50 @@ module FFWD::Plugin::Collectd
|
|
24
24
|
@bind = bind
|
25
25
|
@core = core
|
26
26
|
@types_db = TypesDB.open config[:types_db]
|
27
|
+
@key = config[:key]
|
27
28
|
end
|
28
29
|
|
29
30
|
def receive_data(data)
|
30
31
|
Parser.parse(data) do |metric|
|
31
|
-
|
32
|
-
|
32
|
+
values = metric[:values]
|
33
|
+
time = metric[:time]
|
34
|
+
host = metric[:host]
|
35
|
+
|
36
|
+
attributes = {
|
37
|
+
"plugin" => metric[:plugin],
|
38
|
+
"type" => metric[:type],
|
39
|
+
}
|
33
40
|
|
34
41
|
if instance = metric[:plugin_instance] and not instance.empty?
|
35
|
-
|
42
|
+
attributes[:plugin_instance] = instance
|
36
43
|
end
|
37
44
|
|
38
45
|
if instance = metric[:type_instance] and not instance.empty?
|
39
|
-
|
46
|
+
attributes[:type_instance] = instance
|
40
47
|
end
|
41
48
|
|
42
|
-
key = "#{plugin_key}/#{type_key}"
|
43
|
-
|
44
|
-
values = metric[:values]
|
45
|
-
|
46
|
-
time = metric[:time]
|
47
|
-
host = metric[:host]
|
48
|
-
|
49
49
|
# Just add a running integer to the end of the key, the 'correct'
|
50
50
|
# solution would have been to read, parse and match from a types.db.
|
51
51
|
#
|
52
52
|
# http://collectd.org/documentation/manpages/types.db.5.shtml
|
53
53
|
if values.size > 1
|
54
54
|
values.each_with_index do |v, i|
|
55
|
-
if @types_db and name = @types_db.get_name(
|
55
|
+
if @types_db and name = @types_db.get_name(metric[:type], i)
|
56
56
|
index_key = name
|
57
57
|
else
|
58
58
|
index_key = i.to_s
|
59
59
|
end
|
60
60
|
|
61
61
|
@core.input.metric(
|
62
|
-
:key =>
|
63
|
-
:host => host)
|
62
|
+
:key => @key, :time => time, :value => v[1],
|
63
|
+
:host => host, :attributes => attributes)
|
64
64
|
@bind.increment :received_metrics
|
65
65
|
end
|
66
66
|
else
|
67
67
|
v = values[0]
|
68
68
|
@core.input.metric(
|
69
|
-
:key => key, :time => time, :value => v[1],
|
69
|
+
:key => @key, :time => time, :value => v[1],
|
70
|
+
:host => host, :attributes => attributes)
|
70
71
|
@bind.increment :received_metrics
|
71
72
|
end
|
72
73
|
end
|
data/lib/ffwd/plugin/collectd.rb
CHANGED
@@ -26,6 +26,7 @@ module FFWD::Plugin::Collectd
|
|
26
26
|
DEFAULT_HOST = "localhost"
|
27
27
|
DEFAULT_PORT = 25826
|
28
28
|
DEFAULT_TYPES_DB = "/usr/share/collectd/types.db"
|
29
|
+
DEFAULT_KEY = "collectd"
|
29
30
|
|
30
31
|
register_plugin "collectd",
|
31
32
|
:description => "A plugin for the collectd binary protocol.",
|
@@ -65,6 +66,8 @@ module FFWD::Plugin::Collectd
|
|
65
66
|
config[:port] ||= DEFAULT_PORT
|
66
67
|
config[:types_db] ||= DEFAULT_TYPES_DB
|
67
68
|
config[:protocol] ||= "udp"
|
69
|
+
config[:key] ||= DEFAULT_KEY
|
70
|
+
|
68
71
|
protocol = FFWD.parse_protocol config[:protocol]
|
69
72
|
|
70
73
|
unless connection = INPUTS[protocol.family]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffwd-collectd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John-John Tedro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffwd
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.3.
|
19
|
+
version: 0.3.2
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.3.
|
26
|
+
version: 0.3.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|