fluent-plugin-specinfra_inventory 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +5 -1
- data/lib/fluent/plugin/in_specinfra_inventory.rb +21 -3
- data/lib/fluent/plugin/specinfra_inventory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab4962abfc51a59a788743b26c55cc4a251e595f
|
4
|
+
data.tar.gz: e646b0dc5575f0ccc004eb2cfcbed549b9741f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fcb996c10c39e2e9c4f62b97f0e27b356bc27238fbb5b751c348aa10beeabdf8802a95eec3c3dfaa3f0a06e04e0498e4a05bc63c74350e754e7f628e8435095
|
7
|
+
data.tar.gz: 3addbd5f62a7af81d990e811bb0a0b24be7d39249513e7afa77fe70ca5e5805143b351ad336c6ff359226a852d5ea45c94e8e1adef6a6401e4162fd33feb9ccf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,7 @@ Or install it yourself as:
|
|
27
27
|
tag_prefix example.prefix
|
28
28
|
backend exec
|
29
29
|
inventory_keys ["cpu.total","memory"]
|
30
|
+
combine false
|
30
31
|
family ubuntu
|
31
32
|
release 14.04
|
32
33
|
arch x86_64
|
@@ -51,11 +52,14 @@ default: `specinfra.inventory`
|
|
51
52
|
Specinfra backend type.
|
52
53
|
default: `exec`
|
53
54
|
|
54
|
-
|
55
55
|
### inventory_keys
|
56
56
|
Key of Host Inventory.
|
57
57
|
If you access the key on nested Hash, you should separated by `.`
|
58
58
|
|
59
|
+
### combine
|
60
|
+
Combining values of `inventory_keys` to one record.
|
61
|
+
default: `true`
|
62
|
+
|
59
63
|
### family, release, arch
|
60
64
|
See [Multi OS Support](http://serverspec.org/tutorial.html)
|
61
65
|
|
@@ -13,7 +13,8 @@ module Fluent
|
|
13
13
|
config_param :ssh_user, :string, default: nil
|
14
14
|
config_param :ssh_port, :integer, default: nil
|
15
15
|
config_param :env, :hash, default: {}
|
16
|
-
config_param :inventory_keys,
|
16
|
+
config_param :inventory_keys, :array, default: []
|
17
|
+
config_param :combine, :bool, default: true
|
17
18
|
|
18
19
|
KEY_DELIMITER = "."
|
19
20
|
|
@@ -60,13 +61,30 @@ module Fluent
|
|
60
61
|
def run
|
61
62
|
loop do
|
62
63
|
time = Engine.now
|
63
|
-
@
|
64
|
-
|
64
|
+
if @combine
|
65
|
+
emit_combine_record(time)
|
66
|
+
else
|
67
|
+
emit_separate_record(time)
|
65
68
|
end
|
66
69
|
sleep @time_span
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
73
|
+
def emit_combine_record(time)
|
74
|
+
records = {}
|
75
|
+
@inventory_keys.each do |key|
|
76
|
+
records.merge!(record(key))
|
77
|
+
end
|
78
|
+
Engine.emit(@tag_prefix, time, records) if records.length > 0
|
79
|
+
end
|
80
|
+
|
81
|
+
def emit_separate_record(time)
|
82
|
+
time = Engine.now
|
83
|
+
@inventory_keys.each do |key|
|
84
|
+
Engine.emit(tag(key), time, record(key))
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
70
88
|
def tag(key)
|
71
89
|
"#{@tag_prefix}.#{key}"
|
72
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-specinfra_inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masashi Terui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|