logstash-integration-snmp 4.3.0-java → 4.4.0-java
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 +6 -0
- data/VERSION +1 -1
- data/docs/input-snmp.asciidoc +27 -0
- data/lib/logstash/inputs/snmp.rb +14 -1
- data/lib/logstash-integration-snmp_jars.rb +1 -1
- data/spec/unit/inputs/snmp_spec.rb +40 -29
- data/vendor/jar-dependencies/org/logstash/integrations/plugin/{4.3.0/plugin-4.3.0.jar → 4.4.0/plugin-4.4.0.jar} +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a79607b130f6d5e1b16fa3979be1cddad462aae22e58a481888a35bebbb0c09
|
|
4
|
+
data.tar.gz: 17add7304deab345d2e8b77d58e95835749ccd4c710176aa3b89aedca27578ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22fee9ee3c1b9bcf88682db9fe6ed721c1cb01e46adaacf98e953fe015ef1ff0848b03e0340d0cd26b2e171ace49c9f1d61853de92b41518c89a2cbb2b6a849e
|
|
7
|
+
data.tar.gz: f94e7f9442e9d3078e2bc519b37e413640081137af6911c8ca114f1b366df86054164c4ec192e924d8add40e5b0fc56f56007f8fd1ae21752729e90e29b396ca
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 4.4.0
|
|
2
|
+
- Expose `max_repetitions` config option to the SNMP input plugin, allowing users to control the max-repetitions field in GETBULK PDUs used by walk and table operations. [#97](https://github.com/logstash-plugins/logstash-integration-snmp/pull/97)
|
|
3
|
+
|
|
4
|
+
## 4.3.1
|
|
5
|
+
- Fix: generate error events with _snmpfailure tag when all SNMP operations fail and the response data is empty (e.g., timeout) [#92](https://github.com/logstash-plugins/logstash-integration-snmp/pull/92)
|
|
6
|
+
|
|
1
7
|
## 4.3.0
|
|
2
8
|
- Handle partial responses and errors gracefully: add `tag_on_failure` (default: `["_snmpfailure"]`) to tag events when SNMP operations fail, and `allow_partial_response` (default: `false`) to preserve partial data from failed `walk`/`table` operations [#91](https://github.com/logstash-plugins/logstash-integration-snmp/pull/91)
|
|
3
9
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.4.0
|
data/docs/input-snmp.asciidoc
CHANGED
|
@@ -78,6 +78,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
|
78
78
|
| <<plugins-{type}s-{plugin}-allow_partial_response>> |<<boolean,boolean>>|No
|
|
79
79
|
| <<plugins-{type}s-{plugin}-interval>> |<<number,number>>|No
|
|
80
80
|
| <<plugins-{type}s-{plugin}-local_engine_id>> |<<string,string>>|No
|
|
81
|
+
| <<plugins-{type}s-{plugin}-max_repetitions>> |<<number,number>>|No
|
|
81
82
|
| <<plugins-{type}s-{plugin}-mib_paths>> |<<path,path>>|No
|
|
82
83
|
| <<plugins-{type}s-{plugin}-oid_mapping_format>> |<<string,string>>, one of `["default", "ruby_snmp", "dotted_string"]`|No
|
|
83
84
|
| <<plugins-{type}s-{plugin}-oid_map_field_values>> |<<boolean,boolean>>|No
|
|
@@ -217,6 +218,32 @@ If polling all configured hosts takes longer than this interval, a warning will
|
|
|
217
218
|
The SNMPv3 local engine ID. Its length must be greater or equal than 5 and less or equal than 32.
|
|
218
219
|
If not provided, a default ID is generated based on the local IP address and additional four random bytes.
|
|
219
220
|
|
|
221
|
+
[id="plugins-{type}s-{plugin}-max_repetitions"]
|
|
222
|
+
===== `max_repetitions`
|
|
223
|
+
|
|
224
|
+
* Value type is <<number,number>>
|
|
225
|
+
* Default value is `10`
|
|
226
|
+
|
|
227
|
+
The `max_repetitions` option sets the max-repetitions field in GETBULK PDUs used by `walk` and `table` operations.
|
|
228
|
+
This value controls how many OID rows are returned in each GETBULK response from the SNMP agent.
|
|
229
|
+
|
|
230
|
+
A smaller value may help avoid timeouts when polling devices with large tables or limited resources.
|
|
231
|
+
A larger value can improve performance by reducing the number of round trips needed to retrieve a full table.
|
|
232
|
+
|
|
233
|
+
If not set, the SNMP4J library default of `10` is used.
|
|
234
|
+
|
|
235
|
+
Example
|
|
236
|
+
[source,ruby]
|
|
237
|
+
-----
|
|
238
|
+
input {
|
|
239
|
+
snmp {
|
|
240
|
+
walk => ["1.3.6.1.2.1.2.2"]
|
|
241
|
+
hosts => [{host => "udp:127.0.0.1/161" community => "public"}]
|
|
242
|
+
max_repetitions => 5
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
-----
|
|
246
|
+
|
|
220
247
|
[id="plugins-{type}s-{plugin}-mib_paths"]
|
|
221
248
|
===== `mib_paths`
|
|
222
249
|
|
data/lib/logstash/inputs/snmp.rb
CHANGED
|
@@ -67,6 +67,11 @@ class LogStash::Inputs::Snmp < LogStash::Inputs::Base
|
|
|
67
67
|
# Timeout in milliseconds to execute all hosts configured operations (get, walk, table).
|
|
68
68
|
config :poll_hosts_timeout, :validate => :number
|
|
69
69
|
|
|
70
|
+
# Sets the maximum number of repetitions for GETBULK requests used in `walk` and `table` operations.
|
|
71
|
+
# This controls how many rows are returned per PDU in SNMPv2c/v3 GETBULK requests.
|
|
72
|
+
# Lowering this value may help avoid timeouts when polling devices with large tables.
|
|
73
|
+
config :max_repetitions, :validate => :number, :default => 10
|
|
74
|
+
|
|
70
75
|
# Append values to the `tags` field when one or more SNMP operations fail
|
|
71
76
|
config :tag_on_failure, :validate => :array, :default => ['_snmpfailure']
|
|
72
77
|
|
|
@@ -195,7 +200,7 @@ class LogStash::Inputs::Snmp < LogStash::Inputs::Base
|
|
|
195
200
|
definition = req[:definition]
|
|
196
201
|
result_consumer = lambda do |request_result|
|
|
197
202
|
result = request_result.data
|
|
198
|
-
if result&.any?
|
|
203
|
+
if result&.any? || request_result.has_errors
|
|
199
204
|
event = targeted_event_factory.new_event(result)
|
|
200
205
|
event.set(@host_protocol_field, definition[:host_protocol])
|
|
201
206
|
event.set(@host_address_field, definition[:host_address])
|
|
@@ -263,6 +268,7 @@ class LogStash::Inputs::Snmp < LogStash::Inputs::Base
|
|
|
263
268
|
validate_hosts!
|
|
264
269
|
validate_tables!
|
|
265
270
|
validate_local_engine_id!
|
|
271
|
+
validate_max_repetitions!
|
|
266
272
|
end
|
|
267
273
|
|
|
268
274
|
def validate_oids!
|
|
@@ -328,6 +334,12 @@ class LogStash::Inputs::Snmp < LogStash::Inputs::Base
|
|
|
328
334
|
end
|
|
329
335
|
end
|
|
330
336
|
|
|
337
|
+
def validate_max_repetitions!
|
|
338
|
+
if @max_repetitions <= 0
|
|
339
|
+
raise(LogStash::ConfigurationError, '`max_repetitions` must be a positive integer')
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
|
|
331
343
|
def create_request_aggregator
|
|
332
344
|
SnmpClientRequestAggregator.new(@threads, 'SnmpRequestWorker')
|
|
333
345
|
end
|
|
@@ -335,6 +347,7 @@ class LogStash::Inputs::Snmp < LogStash::Inputs::Base
|
|
|
335
347
|
def build_client!(mib_manager, supported_transports, hosts_versions)
|
|
336
348
|
client_builder = org.logstash.snmp.SnmpClient.builder(mib_manager, supported_transports)
|
|
337
349
|
client_builder.setLocalEngineId(@local_engine_id) unless @local_engine_id.nil?
|
|
350
|
+
client_builder.setMaxRepetitions(@max_repetitions)
|
|
338
351
|
|
|
339
352
|
build_snmp_client!(client_builder, validate_usm_user: hosts_versions.include?('3'))
|
|
340
353
|
end
|
|
@@ -4,4 +4,4 @@ require 'jar_dependencies'
|
|
|
4
4
|
require_jar('org.snmp4j', 'snmp4j-log4j', '2.8.11')
|
|
5
5
|
require_jar('org.snmp4j', 'snmp4j', '3.8.0')
|
|
6
6
|
require_jar('org.snakeyaml', 'snakeyaml-engine', '2.7')
|
|
7
|
-
require_jar('org.logstash.integrations', 'plugin', '4.
|
|
7
|
+
require_jar('org.logstash.integrations', 'plugin', '4.4.0')
|
|
@@ -342,21 +342,41 @@ describe LogStash::Inputs::Snmp, :ecs_compatibility_support do
|
|
|
342
342
|
})
|
|
343
343
|
end
|
|
344
344
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
context 'when result data is not empty' do
|
|
346
|
+
before(:each) do
|
|
347
|
+
expect(mock_aggregator_request).to receive(:get)
|
|
348
|
+
expect(mock_aggregator_request).to receive(:get_result_async) do |consumer|
|
|
349
|
+
consumer.call(RequestResult.new({ 'foo' => 'bar' }, true))
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
it 'should tag event with default failure tag' do
|
|
354
|
+
plugin.register
|
|
355
|
+
plugin.poll_clients(queue)
|
|
356
|
+
event = queue.pop
|
|
357
|
+
|
|
358
|
+
expect(event.get("foo")).to eq("bar")
|
|
359
|
+
expect(event.get("tags")).to include("_snmpfailure")
|
|
360
|
+
expect(event.get("_snmp_request_errors")).to be_nil
|
|
349
361
|
end
|
|
350
362
|
end
|
|
351
363
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
364
|
+
context 'when result data is empty' do
|
|
365
|
+
before(:each) do
|
|
366
|
+
expect(mock_aggregator_request).to receive(:get)
|
|
367
|
+
expect(mock_aggregator_request).to receive(:get_result_async) do |consumer|
|
|
368
|
+
consumer.call(RequestResult.new({}, true))
|
|
369
|
+
end
|
|
370
|
+
end
|
|
356
371
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
372
|
+
it 'should generate an event with failure tag when all operations fail' do
|
|
373
|
+
plugin.register
|
|
374
|
+
plugin.poll_clients(queue)
|
|
375
|
+
event = queue.pop
|
|
376
|
+
|
|
377
|
+
expect(event).not_to be_nil
|
|
378
|
+
expect(event.get("tags")).to include("_snmpfailure")
|
|
379
|
+
end
|
|
360
380
|
end
|
|
361
381
|
end
|
|
362
382
|
|
|
@@ -364,41 +384,32 @@ describe LogStash::Inputs::Snmp, :ecs_compatibility_support do
|
|
|
364
384
|
let(:config) do
|
|
365
385
|
super().merge({
|
|
366
386
|
'get' => ['1.3.6.1.2.1.1.1.0'],
|
|
367
|
-
'hosts' => [{ 'host' => 'udp:127.0.0.1/161', 'community' => 'public' }]
|
|
368
|
-
'allow_partial_response' => allow_partial_response_value
|
|
387
|
+
'hosts' => [{ 'host' => 'udp:127.0.0.1/161', 'community' => 'public' }]
|
|
369
388
|
})
|
|
370
389
|
end
|
|
371
390
|
|
|
372
391
|
before(:each) do
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
consumer.call(RequestResult.new({ 'partial' => 'data' }, true))
|
|
376
|
-
end
|
|
392
|
+
allow(mock_aggregator_request).to receive(:get)
|
|
393
|
+
allow(mock_aggregator_request).to receive(:get_result_async)
|
|
377
394
|
end
|
|
378
395
|
|
|
379
396
|
context 'when set to false (default)' do
|
|
380
|
-
let(:
|
|
397
|
+
let(:config) { super().merge('allow_partial_response' => false) }
|
|
381
398
|
|
|
382
|
-
it '
|
|
399
|
+
it 'uses complete result aggregator' do
|
|
400
|
+
expect(mock_aggregator).to receive(:create_request_for_complete_result).and_return(mock_aggregator_request)
|
|
383
401
|
plugin.register
|
|
384
402
|
plugin.poll_clients(queue)
|
|
385
|
-
event = queue.pop
|
|
386
|
-
|
|
387
|
-
expect(event.get("partial")).to eq("data")
|
|
388
|
-
expect(event.get("tags")).to include("_snmpfailure")
|
|
389
403
|
end
|
|
390
404
|
end
|
|
391
405
|
|
|
392
406
|
context 'when set to true' do
|
|
393
|
-
let(:
|
|
407
|
+
let(:config) { super().merge('allow_partial_response' => true) }
|
|
394
408
|
|
|
395
|
-
it '
|
|
409
|
+
it 'uses partial result aggregator' do
|
|
410
|
+
expect(mock_aggregator).to receive(:create_request_for_partial_result).and_return(mock_aggregator_request)
|
|
396
411
|
plugin.register
|
|
397
412
|
plugin.poll_clients(queue)
|
|
398
|
-
event = queue.pop
|
|
399
|
-
|
|
400
|
-
expect(event.get("partial")).to eq("data")
|
|
401
|
-
expect(event.get("tags")).to include("_snmpfailure")
|
|
402
413
|
end
|
|
403
414
|
end
|
|
404
415
|
end
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-integration-snmp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.4.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-05
|
|
10
|
+
date: 2026-08-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: logstash-core-plugin-api
|
|
@@ -468,7 +468,7 @@ files:
|
|
|
468
468
|
- spec/unit/inputs/common_spec.rb
|
|
469
469
|
- spec/unit/inputs/snmp_spec.rb
|
|
470
470
|
- spec/unit/inputs/snmptrap_spec.rb
|
|
471
|
-
- vendor/jar-dependencies/org/logstash/integrations/plugin/4.
|
|
471
|
+
- vendor/jar-dependencies/org/logstash/integrations/plugin/4.4.0/plugin-4.4.0.jar
|
|
472
472
|
- vendor/jar-dependencies/org/snakeyaml/snakeyaml-engine/2.7/snakeyaml-engine-2.7.jar
|
|
473
473
|
- vendor/jar-dependencies/org/snmp4j/snmp4j-log4j/2.8.11/snmp4j-log4j-2.8.11.jar
|
|
474
474
|
- vendor/jar-dependencies/org/snmp4j/snmp4j/3.8.0/snmp4j-3.8.0.jar
|