logstash-input-snmp 1.3.1 → 1.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
  SHA256:
3
- metadata.gz: 13fdcfbd3e486a466a7fa32e1de3e6bbdccd30779f5eb4fce9ef8645355c8322
4
- data.tar.gz: b8e80f54fbe399f262e48aff1fd614d578b16d493cded3e15446593ebffd1f93
3
+ metadata.gz: 3fe1c5f85dcfcd638d7a15c9798f34d27cee90599d45b984e3a6a9d578233894
4
+ data.tar.gz: 4261ebb2f0e9d7ab9b7f73d11bc2e4b1af37c176131b14c97b4808c249176d45
5
5
  SHA512:
6
- metadata.gz: fc44139cfc59066ffa89fc916903e4507972b9650cc056ee0bb897a8028dcf93abf30c07627926ce717a0da275d084ebf45b7e631355d04752ef55e868eef3f7
7
- data.tar.gz: 1ca064497bd573c6d3de4c00bf0d744fb14339926d61203d6a7e74fcbb6887c64f784e32ecb579db11fc2ff849c329b7479df92a44b24803d653b316ab41cbd6
6
+ metadata.gz: 89ee144bd1e2a3d40dcdd355bac9b330a93b0b011739367721c82e33adca7762e716c53db4f95ae5816a87f004a1155f824603acf0c8f57025ac14502f5b4f11
7
+ data.tar.gz: d7879c1a5de45a5e8f50574223dc883723cdda586540409ced17442f79396fb42669ce6bec8302c3f62d97a2b49927e3e62e7157ac23bec6ebbf05831e753e32
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.3.2
2
+ - Docs: add troubleshooting help for "failed to locate MIB module" error when using smidump to convert MIBs
3
+
1
4
  ## 1.3.1
2
5
  - Refactor: handle no response(s) wout error logging [#105](https://github.com/logstash-plugins/logstash-input-snmp/pull/105)
3
6
 
data/docs/index.asciidoc CHANGED
@@ -63,6 +63,37 @@ $ smidump --level=1 -k -f python RFC1213-MIB > RFC1213-MIB.dic
63
63
 
64
64
  Note that the resulting file as output by `smidump` must have the `.dic` extension.
65
65
 
66
+ As `smidump` only looks for mib dependencies in its pre-configured path lists as defined in the documentaion in the https://www.ibr.cs.tu-bs.de/projects/libsmi/smi_config.html["MODULES LOCATIONS"] section, you may need to provide the paths to locations of MIBs in your particular environment to avoid a `failed to locate MIB module` error.
67
+
68
+ Two ways to achieve this are by using an environment variable or a config file to provide the additional path configuration.
69
+
70
+ Set the `SMIPATH` env var with the path to your mibs ensuring you include a prepended colon `:` for the path, for example:
71
+
72
+ [source,sh]
73
+ -----
74
+ $ SMIPATH=":/path/to/mibs/" smidump -k -f python CISCO-PROCESS-MIB.mib > CISCO-PROCESS-MIB_my.dic
75
+ -----
76
+
77
+ NOTE: SMI docs on the prepended colon:
78
+
79
+ The ‘path’ command argument and the environment variable either start with a path separator character (‘:’ on UNIX-like systems, ‘;’ on MS-Windows systems) to append to the path, or end with a path separator character to prepend to the path, or otherwise completely replace the path.
80
+
81
+
82
+ The other way is to create a configuration file eg `smi.conf` with the `path` option.
83
+
84
+ [source,sh]
85
+ -----
86
+ path :/path/to/mibs/
87
+ -----
88
+
89
+ and use that config with smidump:
90
+
91
+ [source,sh]
92
+ -----
93
+ $ smidump -c smi.conf -k -f python CISCO-PROCESS-MIB.mib > CISCO-PROCESS-MIB_my.dic
94
+ -----
95
+
96
+
66
97
  [id="plugins-{type}s-{plugin}-options"]
67
98
  ==== SNMP Input Configuration Options
68
99
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-snmp'
3
- s.version = '1.3.1'
3
+ s.version = '1.3.2'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "SNMP input plugin"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -2,7 +2,7 @@ require "logstash/devutils/rspec/spec_helper"
2
2
  require "logstash/inputs/snmp"
3
3
 
4
4
  describe LogStash::Inputs::Snmp do
5
- let(:config) { {"get" => ["1.3.6.1.2.1.1.1.0", "1.3.6.1.2.1.1.3.0", "1.3.6.1.2.1.1.5.0"]} }
5
+ let(:config) { {"get" => %w[1.3.6.1.2.1.1.1.0 1.3.6.1.2.1.1.3.0 1.3.6.1.2.1.1.5.0], "ecs_compatibility" => "disabled" } }
6
6
  let(:plugin) { LogStash::Inputs::Snmp.new(config)}
7
7
 
8
8
  shared_examples "snmp plugin return single event" do
@@ -114,8 +114,8 @@ describe LogStash::Inputs::Snmp do
114
114
  end
115
115
 
116
116
  describe "multiple pipelines and mix of udp tcp hosts", :integration => true do
117
- let(:config) { {"get" => ["1.3.6.1.2.1.1.1.0"], "hosts" => [{"host" => "udp:snmp1/161", "community" => "public"}]} }
118
- let(:config2) { {"get" => ["1.3.6.1.2.1.1.1.0"], "hosts" => [{"host" => "tcp:snmp2/162", "community" => "public"}]} }
117
+ let(:config) { {"get" => ["1.3.6.1.2.1.1.1.0"], "hosts" => [{"host" => "udp:snmp1/161", "community" => "public"}], "ecs_compatibility" => "disabled" } }
118
+ let(:config2) { {"get" => ["1.3.6.1.2.1.1.1.0"], "hosts" => [{"host" => "tcp:snmp2/162", "community" => "public"}], "ecs_compatibility" => "disabled"} }
119
119
  let(:plugin) { LogStash::Inputs::Snmp.new(config)}
120
120
  let(:plugin2) { LogStash::Inputs::Snmp.new(config2)}
121
121
 
@@ -148,10 +148,12 @@ describe LogStash::Inputs::Snmp do
148
148
  snmp {
149
149
  get => ["1.3.6.1.2.1.1.1.0"]
150
150
  hosts => [{host => "udp:snmp1/161" community => "public"}]
151
+ ecs_compatibility => "disabled"
151
152
  }
152
153
  snmp {
153
154
  get => ["1.3.6.1.2.1.1.1.0"]
154
155
  hosts => [{host => "tcp:snmp2/162" community => "public"}]
156
+ ecs_compatibility => "disabled"
155
157
  }
156
158
  }
157
159
  CONFIG
@@ -171,6 +173,7 @@ describe LogStash::Inputs::Snmp do
171
173
  priv_protocol => "aes"
172
174
  priv_pass => "STr0ngP@SSWRD161"
173
175
  security_level => "authPriv"
176
+ ecs_compatibility => "disabled"
174
177
  }
175
178
  snmp {
176
179
  get => ["1.3.6.1.2.1.1.1.0"]
@@ -181,6 +184,7 @@ describe LogStash::Inputs::Snmp do
181
184
  priv_protocol => "aes"
182
185
  priv_pass => "STr0ngP@SSWRD162"
183
186
  security_level => "authPriv"
187
+ ecs_compatibility => "disabled"
184
188
  }
185
189
  }
186
190
  CONFIG
@@ -390,5 +390,28 @@ describe LogStash::Inputs::Snmp, :ecs_compatibility_support do
390
390
  end
391
391
  end
392
392
  end
393
+
394
+ context "close" do
395
+ let(:config) do
396
+ <<-CONFIG
397
+ input {
398
+ snmp {
399
+ get => ["1.3.6.1.2.1.1.1.0"]
400
+ hosts => [{host => "udp:127.0.0.1/161" community => "public"}]
401
+ }
402
+ }
403
+ CONFIG
404
+ end
405
+
406
+ before(:each) do
407
+ expect(LogStash::SnmpClient).to receive(:new).and_return(mock_client)
408
+ expect(mock_client).to receive(:get).and_return({"foo" => "bar"})
409
+ end
410
+
411
+ it "should call the close method upon termination" do
412
+ expect(mock_client).to receive(:close).once
413
+ input(config) { }
414
+ end
415
+ end
393
416
  end
394
417
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-snmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-23 00:00:00.000000000 Z
11
+ date: 2023-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -483,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
483
483
  - !ruby/object:Gem::Version
484
484
  version: '0'
485
485
  requirements: []
486
- rubygems_version: 3.1.6
486
+ rubygems_version: 3.2.33
487
487
  signing_key:
488
488
  specification_version: 4
489
489
  summary: SNMP input plugin