ffwd-collectd 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84632368983f61cbfd23176cc3a7a08698b87c2b
4
- data.tar.gz: f61abdf41bef4b4da36fee81255f3f49a3a79431
3
+ metadata.gz: b8d614177f14e30bb8d304dceed417a525263909
4
+ data.tar.gz: 098d8eaa876fd78cd41a674526be5ef635cc7f41
5
5
  SHA512:
6
- metadata.gz: 1585e9f8646985bb6442f8c695f3d6921a49780359abfbd56b0b529715af251e5e6914bfc2a4cc16fe26b87724278e07b3c07a4cfbb7eab340057081de1004ce
7
- data.tar.gz: ab0536abd15a34ec92ce0d3ce86b45c72066e7cf15b1bb7fb005980fbd60ec96695d87bd2e19fc28e6c7dd7bd98afe964b5f328384588574f4bdaf08ba189cd4
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
- plugin_key = metric[:plugin]
32
- type_key = metric[:type]
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
- plugin_key = "#{plugin_key}-#{instance}"
42
+ attributes[:plugin_instance] = instance
36
43
  end
37
44
 
38
45
  if instance = metric[:type_instance] and not instance.empty?
39
- type_key = "#{type_key}-#{instance}"
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(type_key, i)
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 => "#{key}_#{index_key}", :time => time, :value => v[1],
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], :host => host)
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
@@ -16,7 +16,7 @@
16
16
  module FFWD
17
17
  module Plugin
18
18
  module Collectd
19
- VERSION = "0.3.1"
19
+ VERSION = "0.3.2"
20
20
  end
21
21
  end
22
22
  end
@@ -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.1
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-07 00:00:00.000000000 Z
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.1
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.1
26
+ version: 0.3.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement