logstash-codec-collectd 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/logstash/codecs/collectd.rb +4 -1
- data/logstash-codec-collectd.gemspec +1 -1
- data/spec/codecs/collectd_spec.rb +71 -53
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 203b89f4f6e554a81c36f4d452ee2fae6941ce3a
|
4
|
+
data.tar.gz: 776de9ef6513114401342ccdc7cc5bd039966463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 256fb0ec5cc4546881b820ff61970fa9c2db4b4b83e642f631b3552e730c6d47a99b68d59cd316c0df7aad035e4e8b0043ba6bd4105cd3ff993cd1f3f81831d7
|
7
|
+
data.tar.gz: af4de700cfc0c1fc1853dbfa2aab50645603f17d0ef18ffd9ae7aa58d9451181188c728353c63db90a1cfb1a218e022b35d91f6c282b549736058bf66fde6800
|
data/CHANGELOG.md
ADDED
@@ -73,6 +73,7 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
|
|
73
73
|
'host' => true,
|
74
74
|
'@timestamp' => true,
|
75
75
|
'type_instance' => true,
|
76
|
+
'severity' => true,
|
76
77
|
}
|
77
78
|
|
78
79
|
COLLECTD_TYPE_FIELDS = {
|
@@ -81,11 +82,13 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
|
|
81
82
|
'plugin' => true,
|
82
83
|
'plugin_instance' => true,
|
83
84
|
'type_instance' => true,
|
85
|
+
'severity' => true,
|
84
86
|
}
|
85
87
|
|
86
88
|
INTERVAL_VALUES_FIELDS = {
|
87
89
|
"interval" => true,
|
88
90
|
"values" => true,
|
91
|
+
"message" => true,
|
89
92
|
}
|
90
93
|
|
91
94
|
INTERVAL_BASE_FIELDS = {
|
@@ -273,7 +276,7 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
|
|
273
276
|
8 => hirestime_decoder,
|
274
277
|
9 => hiresinterval_decoder,
|
275
278
|
256 => string_decoder,
|
276
|
-
257 =>
|
279
|
+
257 => counter_decoder,
|
277
280
|
512 => signature_decoder,
|
278
281
|
528 => encryption_decoder
|
279
282
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-collectd'
|
4
|
-
s.version = '0.1.
|
4
|
+
s.version = '0.1.10'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Read events from the collectd binary protocol"
|
7
7
|
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
@@ -5,7 +5,7 @@ require "insist"
|
|
5
5
|
require "tempfile"
|
6
6
|
|
7
7
|
describe LogStash::Codecs::Collectd do
|
8
|
-
context "
|
8
|
+
context "Normal message handling" do
|
9
9
|
subject do
|
10
10
|
next LogStash::Codecs::Collectd.new({})
|
11
11
|
end
|
@@ -17,45 +17,63 @@ describe LogStash::Codecs::Collectd do
|
|
17
17
|
subject.decode(payload) do |event|
|
18
18
|
case counter
|
19
19
|
when 0
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
expect(event['host']).to eq("lieters-klaptop.prot.plexis.eu")
|
21
|
+
expect(event['plugin']).to eq("interface")
|
22
|
+
expect(event['plugin_instance']).to eq("wlan0")
|
23
|
+
expect(event['collectd_type']).to eq("if_errors")
|
24
|
+
expect(event['rx']).to eq(0)
|
25
|
+
expect(event['tx']).to eq(0)
|
26
26
|
when 2
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
expect(event['host']).to eq("lieters-klaptop.prot.plexis.eu")
|
28
|
+
expect(event['plugin']).to eq("entropy")
|
29
|
+
expect(event['collectd_type']).to eq("entropy")
|
30
|
+
expect(event['value']).to eq(157.0)
|
31
31
|
end
|
32
32
|
counter += 1
|
33
33
|
end
|
34
|
-
|
34
|
+
expect(counter).to eq(28)
|
35
35
|
end # it "should parse a normal packet"
|
36
36
|
|
37
|
+
it "should parse a packet with a message and a severity" do
|
38
|
+
payload = ["000000236c6965746572732d6b6c6170746f702e70726f742e706c657869732e6575000008000c14b0a645f3eb73c30009000c00000002800000000002000e696e74657266616365000003000a776c616e30000004000e69665f6572726f7273000006001800020202000000000000000000000000000000000008000c14b0a645f3eb525e000300076c6f000004000f69665f7061636b6574730000060018000202020000000000001cd80000000000001cd80008000c14b0a645f3ebf8c10002000c656e74726f70790000030005000004000c656e74726f7079000006000f0001010000000000a063400008000c14b0a645f3eb6c700002000e696e74657266616365000003000a776c616e30000004000f69665f7061636b657473000006001800020202000000000002d233000000000001c3b10008000c14b0a645f3eb59b1000300076c6f000004000e69665f6572726f7273000006001800020202000000000000000000000000000000000008000c14b0a645f425380b00020009737761700000030005000004000973776170000005000975736564000006000f00010100000000000000000008000c14b0a645f4254c8d0005000966726565000006000f00010100000000fcffdf410008000c14b0a645f4255ae70005000b636163686564000006000f00010100000000000000000008000c14b0a645f426f09f0004000c737761705f696f0000050007696e000006000f00010200000000000000000008000c14b0a645f42701e7000500086f7574000006000f00010200000000000000000008000c14b0a645f42a0edf0002000a7573657273000004000a75736572730000050005000006000f00010100000000000022400008000c14b0a645f5967c8b0002000e70726f636573736573000004000d70735f7374617465000005000c72756e6e696e67000006000f00010100000000000000000008000c14b0a645f624706c0005000d736c656570696e67000006000f0001010000000000c067400008000c14b0a645f624861a0005000c7a6f6d62696573000006000f00010100000000000000000008000c14b0a645f62494740005000c73746f70706564000006000f00010100000000000010400008000c14b0a645f6254aa90005000b706167696e67000006000f00010100000000000000000008000c14b0a645f6255b110005000c626c6f636b6564000006000f00010100000000000000000008000c14b0a645f62763060004000e666f726b5f726174650000050005000006000f00010200000000000025390008000c14b0a64873bf8f47000200086370750000030006300000040008637075000005000975736572000006000f0001020000000000023caa0008000c14b0a64873bfc9dd000500096e696365000006000f00010200000000000000030008000c14b0a64873bfe9350005000b73797374656d000006000f00010200000000000078bc0008000c14b0a64873c004290005000969646c65000006000f00010200000000000941fe0008000c14b0a64873c020920005000977616974000006000f00010200000000000002050008000c14b0a64873c03e280005000e696e74657272757074000006000f00010200000000000000140008000c14b0a64873c04ba20005000c736f6674697271000006000f00010200000000000001890008000c14b0a64873c058860005000a737465616c000006000f00010200000000000000000008000c14b0a64873c071b80003000631000005000975736572000006000f000102000000000002440e0008000c14b0a64873c07f31000500096e696365000006000f00010200000000000000070001000c00000000556dd2fa0101000c000000000000000200000015746573742e6578616d706c652e636f6d00000200096c6f616400000400096c6f6164000100001154657374204d65737361676500"].pack('H*')
|
39
|
+
|
40
|
+
counter = 0
|
41
|
+
subject.decode(payload) do |event|
|
42
|
+
case counter
|
43
|
+
when 29
|
44
|
+
expect(event['host']).to eq("test.example.com")
|
45
|
+
expect(event['plugin']).to eq("load")
|
46
|
+
expect(event['collectd_type']).to eq("load")
|
47
|
+
expect(event['message']).to eq("Test Message")
|
48
|
+
expect(event['severity']).to eq(2)
|
49
|
+
end
|
50
|
+
counter += 1
|
51
|
+
end
|
52
|
+
expect(counter).to eq(29)
|
53
|
+
end # it "should parse a packet with a message and a severity"
|
54
|
+
|
37
55
|
it "should drop a part with an header length" do
|
38
56
|
payload = ["000000236c6965746572732d6b6c6170746f702e70726f742e706c657869732e6575000008000c14b0a645f3eb73c30009000c00000002800000000002000e696e74657266616365000003000a776c616e30000004000e69665f6572726f7273000006001800020202000000000000000000000000000000000008000c14b0a645f3eb525e000300076c6f000004000f69665f7061636b6574730000060018000202020000000000001cd80000000000001cd80008000c14b0a645f3ebf8c10002000c656e74726f70790000030005000004000c656e74726f7079000006000f0001010000000000a063400008000c14b0a645f3eb6c700002000e696e74657266616365000003000a776c616e30000004000f69665f7061636b657473000006001800020202000000000002d233000000000001c3b10008000c14b0a645f3eb59b1000300076c6f000004000e69665f6572726f7273000006001800020202000000000000000000000000000000000008000c14b0a645f425380b00020009737761700000030005000004000973776170000005000975736564000006000f00010100000000000000000008000c14b0a645f4254c8d0005000966726565000006000f00010100000000fcffdf410008000c14b0a645f4255ae70005000b636163686564000006000f00010100000000000000000008000c14b0a645f426f09f0004000c737761705f696f0000050007696e000006000f00010200000000000000000008000c14b0a645f42701e7000500086f7574000006000f00010200000000000000000008000c14b0a645f42a0edf0002000a7573657273000004000a75736572730000050005000006000f00010100000000000022400008000c14b0a645f5967c8b0002000e70726f636573736573000004000d70735f7374617465000005000c72756e6e696e67000006000f00010100000000000000000008000c14b0a645f624706c0005000d736c656570696e67000006000f0001010000000000c067400008000c14b0a645f624861a0005000c7a6f6d62696573000006000f00010100000000000000000008000c14b0a645f62494740005000c73746f70706564000006000f00010100000000000010400008000c14b0a645f6254aa90005000b706167696e67000006000f00010100000000000000000008000c14b0a645f6255b110005000c626c6f636b6564000006000f00010100000000000000000008000c14b0a645f62763060004000e666f726b5f726174650000050005000006000f00010200000000000025390008000c14b0a64873bf8f47000200086370750000030006300000040008637075000005000975736572000006000f0001020000000000023caa0008000c14b0a64873bfc9dd000500096e696365000006000f00010200000000000000030008000c14b0a64873bfe9350005000b73797374656d000006000f00010200000000000078bc0008000c14b0a64873c004290005000969646c65000006000f00010200000000000941fe0008000c14b0a64873c020920005000977616974000006000f00010200000000000002050008000c14b0a64873c03e280005000e696e74657272757074000006000f00010200000000000000140008000c14b0a64873c04ba20005000c736f6674697271000006000f00010200000000000001890008000c14b0a64873c058860005000a737465616c000006000f00010200000000000000000008000c14b0a64873c071b80003000631000005000975736572000006000f000102000000000002440e0008000c14b0a64873c07f31000500316e696365000006000f0001020000000000000007"].pack('H*')
|
39
57
|
counter = 0
|
40
58
|
subject.decode(payload) do |event|
|
41
59
|
case counter
|
42
60
|
when 0
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
61
|
+
expect(event['host']).to eq("lieters-klaptop.prot.plexis.eu")
|
62
|
+
expect(event['plugin']).to eq("interface")
|
63
|
+
expect(event['plugin_instance']).to eq("wlan0")
|
64
|
+
expect(event['collectd_type']).to eq("if_errors")
|
65
|
+
expect(event['rx']).to eq(0)
|
66
|
+
expect(event['tx']).to eq(0)
|
49
67
|
when 2
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
68
|
+
expect(event['host']).to eq("lieters-klaptop.prot.plexis.eu")
|
69
|
+
expect(event['plugin']).to eq("entropy")
|
70
|
+
expect(event['collectd_type']).to eq("entropy")
|
71
|
+
expect(event['value']).to eq(157.0)
|
54
72
|
end
|
55
73
|
counter += 1
|
56
74
|
end
|
57
75
|
# One of these will fail because I altered the payload from the normal packet
|
58
|
-
|
76
|
+
expect(counter).to eq(27)
|
59
77
|
end # it "should drop a part with an header length"
|
60
78
|
|
61
79
|
# This payload contains a NaN value
|
@@ -65,16 +83,16 @@ describe LogStash::Codecs::Collectd do
|
|
65
83
|
subject.decode(payload) do |event|
|
66
84
|
case counter
|
67
85
|
when 0
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
86
|
+
expect(event['host']).to eq("test.example.com")
|
87
|
+
expect(event['plugin']).to eq("ping")
|
88
|
+
expect(event['type_instance']).to eq("ping-target.example.com")
|
89
|
+
expect(event['collectd_type']).to eq("ping")
|
90
|
+
expect(event['value']).to eq(0) # Not a NaN
|
91
|
+
expect(event['tags']).to eq(["_collectdNaN"])
|
74
92
|
end
|
75
93
|
counter += 1
|
76
94
|
end
|
77
|
-
|
95
|
+
expect(counter).to eq(1)
|
78
96
|
end # it "should replace a NaN with a zero and add tag '_collectdNaN' by default"
|
79
97
|
end # context "None"
|
80
98
|
|
@@ -90,16 +108,16 @@ describe LogStash::Codecs::Collectd do
|
|
90
108
|
subject.decode(payload) do |event|
|
91
109
|
case counter
|
92
110
|
when 0
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
111
|
+
expect(event['host']).to eq("test.example.com")
|
112
|
+
expect(event['plugin']).to eq("ping")
|
113
|
+
expect(event['type_instance']).to eq("ping-target.example.com")
|
114
|
+
expect(event['collectd_type']).to eq("ping")
|
115
|
+
expect(event['value']).to eq(1) # Not a NaN
|
116
|
+
expect(event['tags']).to eq(["NaN_encountered"])
|
99
117
|
end
|
100
118
|
counter += 1
|
101
119
|
end
|
102
|
-
|
120
|
+
expect(counter).to eq(1)
|
103
121
|
end # it "should replace a NaN with the specified value and tag 'NaN_encountered'"
|
104
122
|
end # context "Replace nan_value and nan_tag with non-default values"
|
105
123
|
|
@@ -115,15 +133,15 @@ describe LogStash::Codecs::Collectd do
|
|
115
133
|
subject.decode(payload) do |event|
|
116
134
|
case counter
|
117
135
|
when 0
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
136
|
+
expect(event['host']).to eq("test.example.com")
|
137
|
+
expect(event['plugin']).to eq("ping")
|
138
|
+
expect(event['type_instance']).to eq("ping-target.example.com")
|
139
|
+
expect(event['collectd_type']).to eq("ping")
|
140
|
+
expect(event['value']).to eq(0) # Not a NaN
|
123
141
|
end
|
124
142
|
counter += 1
|
125
143
|
end
|
126
|
-
|
144
|
+
expect(counter).to eq(1)
|
127
145
|
end # it "should replace a NaN with a zero and receive a warning when 'nan_handling' set to warn"
|
128
146
|
end # context "Warn on NaN event"
|
129
147
|
|
@@ -138,15 +156,15 @@ describe LogStash::Codecs::Collectd do
|
|
138
156
|
subject.decode(payload) do |event|
|
139
157
|
case counter
|
140
158
|
when 0
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
159
|
+
expect(event['host']).to eq("test.example.com")
|
160
|
+
expect(event['plugin']).to eq("ping")
|
161
|
+
expect(event['type_instance']).to eq("ping-target.example.com")
|
162
|
+
expect(event['collectd_type']).to eq("ping")
|
163
|
+
expect(event['value']).to eq(NaN) # NaN
|
146
164
|
end
|
147
165
|
counter += 1 # Because we're dropping this, it should not increment
|
148
166
|
end
|
149
|
-
|
167
|
+
expect(counter).to eq(0) # We expect no increment
|
150
168
|
end # it "should drop an event with a NaN value when 'nan_handling' set to drop"
|
151
169
|
end # context "Drop NaN event"
|
152
170
|
|
@@ -168,7 +186,7 @@ describe LogStash::Codecs::Collectd do
|
|
168
186
|
counter += 1
|
169
187
|
end
|
170
188
|
|
171
|
-
|
189
|
+
expect(counter).to eq(24)
|
172
190
|
end # it "should parse a correctly signed packet"
|
173
191
|
|
174
192
|
it "should not parse an incorrectly signed packet" do
|
@@ -178,7 +196,7 @@ describe LogStash::Codecs::Collectd do
|
|
178
196
|
counter += 1
|
179
197
|
end
|
180
198
|
|
181
|
-
|
199
|
+
expect(counter).to eq(0)
|
182
200
|
end # it "should not parse and incorrectly signed packet"
|
183
201
|
end # context "Sign"
|
184
202
|
|
@@ -195,7 +213,7 @@ describe LogStash::Codecs::Collectd do
|
|
195
213
|
counter += 1
|
196
214
|
end
|
197
215
|
|
198
|
-
|
216
|
+
expect(counter).to eq(24)
|
199
217
|
end # it "should parse an encrypted packet"
|
200
218
|
|
201
219
|
it "should not parse unencrypted packets when encrypt is configured" do
|
@@ -205,7 +223,7 @@ describe LogStash::Codecs::Collectd do
|
|
205
223
|
counter += 1
|
206
224
|
end
|
207
225
|
|
208
|
-
|
226
|
+
expect(counter).to eq(0)
|
209
227
|
end # it "should not parse unencrypted packets when encrypt is configured"
|
210
228
|
end # context "Encrypt"
|
211
229
|
end # describe LogStash::Codecs::Collectd
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-codec-collectd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
14
|
+
name: logstash-core
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - '>='
|
17
18
|
- !ruby/object:Gem::Version
|
@@ -19,10 +20,7 @@ dependencies:
|
|
19
20
|
- - <
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 2.0.0
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
type: :runtime
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
26
24
|
requirements:
|
27
25
|
- - '>='
|
28
26
|
- !ruby/object:Gem::Version
|
@@ -30,20 +28,22 @@ dependencies:
|
|
30
28
|
- - <
|
31
29
|
- !ruby/object:Gem::Version
|
32
30
|
version: 2.0.0
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
|
34
|
+
name: logstash-devutils
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
36
|
requirements:
|
36
37
|
- - '>='
|
37
38
|
- !ruby/object:Gem::Version
|
38
39
|
version: '0'
|
39
|
-
|
40
|
-
prerelease: false
|
41
|
-
type: :development
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
43
41
|
requirements:
|
44
42
|
- - '>='
|
45
43
|
- !ruby/object:Gem::Version
|
46
44
|
version: '0'
|
45
|
+
prerelease: false
|
46
|
+
type: :development
|
47
47
|
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
|
48
48
|
email: info@elastic.co
|
49
49
|
executables: []
|
@@ -51,6 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
53
|
- .gitignore
|
54
|
+
- CHANGELOG.md
|
54
55
|
- CONTRIBUTORS
|
55
56
|
- Gemfile
|
56
57
|
- LICENSE
|