fluent-plugin-specinfra_inventory 0.0.1 → 0.0.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +7 -5
- data/lib/fluent/plugin/in_specinfra_inventory.rb +9 -1
- data/lib/fluent/plugin/specinfra_inventory/version.rb +1 -1
- data/spec/in_specinfra_inventory_spec.rb +16 -4
- data/spec/spec_helper.rb +0 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c35a9f933b74336ff3368f97af2aa0b395900ca5
|
4
|
+
data.tar.gz: 97e3626f3e103d249fb71c9d5372175cd63e1f25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b60860e63defc7b0768512ffc7c076e9df51b71f64a5751a23871efe4cf2a8f9a94a577f0921a96c9f1bcd38413602dd2599d6575e70c2c8fe2ac88723b2a332
|
7
|
+
data.tar.gz: 81ef6e0ea37192b585d6562874a7c0af2b3d36626d15b1a3c27fedfa0bede4c6ca0baad884c304e42bf42a767d6d9541d866fa746ac25461876b7c845491d64b
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# fluent-plugin-specinfra_inventory
|
2
|
+
[](http://badge.fury.io/rb/fluent-plugin-specinfra_inventory)
|
2
3
|
|
3
4
|
Specinfra Host Inventory Plugin for [Fluentd](http://github.com/fluent/fluentd)
|
4
5
|
|
@@ -25,7 +26,7 @@ Or install it yourself as:
|
|
25
26
|
time_span 300
|
26
27
|
tag_prefix example.prefix
|
27
28
|
backend exec
|
28
|
-
inventory_keys ["cpu","memory"]
|
29
|
+
inventory_keys ["cpu.total","memory"]
|
29
30
|
family ubuntu
|
30
31
|
release 14.04
|
31
32
|
arch x86_64
|
@@ -47,21 +48,22 @@ Event tags are added together inventory key at the end. like: `example.prefix.cp
|
|
47
48
|
default: `specinfra.inventory`
|
48
49
|
|
49
50
|
### backend
|
50
|
-
Specinfra backend type
|
51
|
+
Specinfra backend type.
|
51
52
|
default: `exec`
|
52
53
|
|
53
54
|
|
54
55
|
### inventory_keys
|
55
|
-
Key of Host Inventory
|
56
|
+
Key of Host Inventory.
|
57
|
+
If you access the key on nested Hash, you should separated by `.`
|
56
58
|
|
57
59
|
### family, release, arch
|
58
60
|
See [Multi OS Support](http://serverspec.org/tutorial.html)
|
59
61
|
|
60
62
|
### path
|
61
|
-
`PATH`
|
63
|
+
Environment variable `PATH`
|
62
64
|
|
63
65
|
### host
|
64
|
-
Target
|
66
|
+
Target hostname or IP
|
65
67
|
|
66
68
|
### ssh_user
|
67
69
|
SSH user name
|
@@ -15,6 +15,10 @@ module Fluent
|
|
15
15
|
config_param :env, :hash, default: {}
|
16
16
|
config_param :inventory_keys, :array
|
17
17
|
|
18
|
+
KEY_DELIMITER = "."
|
19
|
+
|
20
|
+
attr_accessor :inventory
|
21
|
+
|
18
22
|
def initialize
|
19
23
|
super
|
20
24
|
require 'specinfra'
|
@@ -68,7 +72,11 @@ module Fluent
|
|
68
72
|
end
|
69
73
|
|
70
74
|
def record(key)
|
71
|
-
@inventory
|
75
|
+
inv = @inventory
|
76
|
+
key.split(KEY_DELIMITER).each do |k|
|
77
|
+
inv = inv[k]
|
78
|
+
end
|
79
|
+
inv
|
72
80
|
end
|
73
81
|
|
74
82
|
end
|
@@ -5,6 +5,14 @@ describe Fluent::SpecinfraInventoryInput do
|
|
5
5
|
before do
|
6
6
|
Fluent::Test.setup
|
7
7
|
@d = Fluent::Test::InputTestDriver.new(Fluent::SpecinfraInventoryInput).configure(config)
|
8
|
+
@d.instance.inventory = {
|
9
|
+
'cpu' => {
|
10
|
+
'total' => "2",
|
11
|
+
'0' => {
|
12
|
+
'vendor_id' => "1"
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
8
16
|
end
|
9
17
|
|
10
18
|
let(:config) do
|
@@ -12,7 +20,7 @@ describe Fluent::SpecinfraInventoryInput do
|
|
12
20
|
time_span 300
|
13
21
|
tag_prefix test.prefix
|
14
22
|
backend exec
|
15
|
-
inventory_keys ["cpu"]
|
23
|
+
inventory_keys ["cpu.0"]
|
16
24
|
family ubuntu
|
17
25
|
release 14.04
|
18
26
|
arch x86_64
|
@@ -28,7 +36,7 @@ describe Fluent::SpecinfraInventoryInput do
|
|
28
36
|
example { expect(@d.instance.time_span).to eq 300 }
|
29
37
|
example { expect(@d.instance.tag_prefix).to eq "test.prefix" }
|
30
38
|
example { expect(@d.instance.backend).to eq "exec" }
|
31
|
-
example { expect(@d.instance.inventory_keys).to eq ["cpu"] }
|
39
|
+
example { expect(@d.instance.inventory_keys).to eq ["cpu.0"] }
|
32
40
|
example { expect(@d.instance.family).to eq "ubuntu" }
|
33
41
|
example { expect(@d.instance.release).to eq "14.04" }
|
34
42
|
example { expect(@d.instance.arch).to eq "x86_64" }
|
@@ -43,7 +51,11 @@ describe Fluent::SpecinfraInventoryInput do
|
|
43
51
|
example { expect(@d.instance.tag("cpu")).to eq "test.prefix.cpu" }
|
44
52
|
end
|
45
53
|
|
46
|
-
describe "record" do
|
47
|
-
example { expect(@d.instance.record("cpu")).to
|
54
|
+
describe "record on flat hash" do
|
55
|
+
example { expect(@d.instance.record("cpu")).to include('total' => "2") }
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "record on nested hash" do
|
59
|
+
example { expect(@d.instance.record("cpu.0")).to include('vendor_id' => "1") }
|
48
60
|
end
|
49
61
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,8 +4,6 @@ Coveralls.wear!
|
|
4
4
|
require 'fluent/load'
|
5
5
|
require 'fluent/test'
|
6
6
|
|
7
|
-
require 'fluent/plugin/in_specinfra_inventory'
|
8
|
-
|
9
7
|
RSpec.configure do |config|
|
10
8
|
# rspec-expectations config goes here. You can use an alternate
|
11
9
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
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.2
|
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-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
106
|
- ".travis.yml"
|
107
|
+
- CHANGELOG.md
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE.txt
|
109
110
|
- README.md
|