logstash-input-snmptrap 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35f826339bdfade97bc430f9d3482eda7538fd12
4
- data.tar.gz: e8cdd9b865a53cf0431d01c861851c10dc1f76c6
3
+ metadata.gz: c759abcd6c485c8edba0993e3c2df4371b456ebe
4
+ data.tar.gz: c84414fc3eba899cdea271f7f21ebc15ff425236
5
5
  SHA512:
6
- metadata.gz: 07d95b9c61dc8f4bdef4c713dd9f1ee3efec8bd92cc48723c3a3b5875c5cd6af18d7c202bffaf0c814f0e1bbd86a67911769bcfb7948000e29c23bee095fe806
7
- data.tar.gz: d234efa3c538aa2c9d685b39efbea90e469f1f26e4b6d4d4e3791dab2f81da9ff3a2d2fc1231c67b7f068ebc80e1b0251a77b0eff3bce85e35ae8c9c59a33771
6
+ metadata.gz: e745c5e8a9679a51aa0c11a56b8d5709429948131caa1e7c97b41400b36d4803a2dee82b9c7fa4e015f5bf0832c4cbb6d7c4425529203d31751243399632c99d
7
+ data.tar.gz: 4a48277be79c7b899c47a4c92cb142c4015a90dda376ee833c50ff6897ffc1b8ffe3a548c4b35b6a4f7f2b9d7d3905491ebf2fa08445d2f5a8ca6ee02b976456
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Logstash Plugin
2
2
 
3
- This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
3
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
4
 
5
5
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
6
6
 
7
7
  ## Documentation
8
8
 
9
- Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
9
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
10
10
 
11
11
  - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
- - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
13
 
14
14
  ## Need Help?
15
15
 
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
83
83
 
84
84
  It is more important to the community that you are able to contribute.
85
85
 
86
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -2,13 +2,15 @@
2
2
  require "logstash/inputs/base"
3
3
  require "logstash/namespace"
4
4
 
5
+ require "snmp"
6
+
5
7
  # Read snmp trap messages as events
6
8
  #
7
9
  # Resulting `@message` looks like :
8
10
  # [source,ruby]
9
- # #<SNMP::SNMPv1_Trap:0x6f1a7a4 @varbind_list=[#<SNMP::VarBind:0x2d7bcd8f @value="teststring",
10
- # @name=[1.11.12.13.14.15]>], @timestamp=#<SNMP::TimeTicks:0x1af47e9d @value=55>, @generic_trap=6,
11
- # @enterprise=[1.2.3.4.5.6], @source_ip="127.0.0.1", @agent_addr=#<SNMP::IpAddress:0x29a4833e @value="\xC0\xC1\xC2\xC3">,
11
+ # #<SNMP::SNMPv1_Trap:0x6f1a7a4 @varbind_list=[#<SNMP::VarBind:0x2d7bcd8f @value="teststring",
12
+ # @name=[1.11.12.13.14.15]>], @timestamp=#<SNMP::TimeTicks:0x1af47e9d @value=55>, @generic_trap=6,
13
+ # @enterprise=[1.2.3.4.5.6], @source_ip="127.0.0.1", @agent_addr=#<SNMP::IpAddress:0x29a4833e @value="\xC0\xC1\xC2\xC3">,
12
14
  # @specific_trap=99>
13
15
  #
14
16
 
@@ -32,9 +34,7 @@ class LogStash::Inputs::Snmptrap < LogStash::Inputs::Base
32
34
  super(*args)
33
35
  end # def initialize
34
36
 
35
- public
36
37
  def register
37
- require "snmp"
38
38
  @snmptrap = nil
39
39
  if @yamlmibdir
40
40
  @logger.info("checking #{@yamlmibdir} for MIBs")
@@ -47,26 +47,35 @@ class LogStash::Inputs::Snmptrap < LogStash::Inputs::Base
47
47
  end
48
48
  end # def register
49
49
 
50
- public
51
50
  def run(output_queue)
52
51
  begin
53
52
  # snmp trap server
54
53
  snmptrap_listener(output_queue)
55
54
  rescue => e
56
55
  @logger.warn("SNMP Trap listener died", :exception => e, :backtrace => e.backtrace)
57
- sleep(5)
58
- retry
56
+ Stud.stoppable_sleep(5) { stop? }
57
+ retry if !stop?
59
58
  end # begin
60
59
  end # def run
61
60
 
61
+ def stop
62
+ @snmptrap.exit unless @snmptrap.nil?
63
+ @snmptrap = nil
64
+ end
65
+
62
66
  private
63
- def snmptrap_listener(output_queue)
67
+
68
+ def build_trap_listener
64
69
  traplistener_opts = {:Port => @port, :Community => @community, :Host => @host}
65
70
  if @yaml_mibs && !@yaml_mibs.empty?
66
71
  traplistener_opts.merge!({:MibDir => @yamlmibdir, :MibModules => @yaml_mibs})
67
72
  end
68
73
  @logger.info("It's a Trap!", traplistener_opts.dup)
69
74
  @snmptrap = SNMP::TrapListener.new(traplistener_opts)
75
+ end
76
+
77
+ def snmptrap_listener(output_queue)
78
+ build_trap_listener
70
79
 
71
80
  @snmptrap.on_trap_default do |trap|
72
81
  begin
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-snmptrap'
4
- s.version = '1.0.0'
4
+ s.version = '2.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Read snmp trap messages as events"
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"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -20,9 +20,10 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency "logstash-core", "~> 2.0.0.snapshot"
24
24
 
25
25
  s.add_runtime_dependency 'snmp'
26
+ s.add_runtime_dependency 'logstash-codec-plain'
26
27
 
27
28
  s.add_development_dependency 'logstash-devutils'
28
29
  end
@@ -1 +1,12 @@
1
1
  require "logstash/devutils/rspec/spec_helper"
2
+ require 'logstash/inputs/snmptrap'
3
+
4
+ describe LogStash::Inputs::Snmptrap do
5
+ it_behaves_like "an interruptible input plugin" do
6
+ # as there is no mocking the run method will
7
+ # raise a connection error and put the run method
8
+ # into the sleep retry section loop
9
+ # meaning that the stoppable sleep impl is tested
10
+ let(:config) { {} }
11
+ end
12
+ end
metadata CHANGED
@@ -1,77 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-snmptrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ~>
17
+ - !ruby/object:Gem::Version
18
+ version: 2.0.0.snapshot
14
19
  name: logstash-core
20
+ prerelease: false
21
+ type: :runtime
15
22
  version_requirements: !ruby/object:Gem::Requirement
16
23
  requirements:
17
- - - '>='
24
+ - - ~>
18
25
  - !ruby/object:Gem::Version
19
- version: 1.4.0
20
- - - <
21
- - !ruby/object:Gem::Version
22
- version: 2.0.0
26
+ version: 2.0.0.snapshot
27
+ - !ruby/object:Gem::Dependency
23
28
  requirement: !ruby/object:Gem::Requirement
24
29
  requirements:
25
30
  - - '>='
26
31
  - !ruby/object:Gem::Version
27
- version: 1.4.0
28
- - - <
29
- - !ruby/object:Gem::Version
30
- version: 2.0.0
32
+ version: '0'
33
+ name: snmp
31
34
  prerelease: false
32
35
  type: :runtime
33
- - !ruby/object:Gem::Dependency
34
- name: snmp
35
36
  version_requirements: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - '>='
38
39
  - !ruby/object:Gem::Version
39
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
40
42
  requirement: !ruby/object:Gem::Requirement
41
43
  requirements:
42
44
  - - '>='
43
45
  - !ruby/object:Gem::Version
44
46
  version: '0'
47
+ name: logstash-codec-plain
45
48
  prerelease: false
46
49
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- name: logstash-devutils
49
50
  version_requirements: !ruby/object:Gem::Requirement
50
51
  requirements:
51
52
  - - '>='
52
53
  - !ruby/object:Gem::Version
53
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
54
56
  requirement: !ruby/object:Gem::Requirement
55
57
  requirements:
56
58
  - - '>='
57
59
  - !ruby/object:Gem::Version
58
60
  version: '0'
61
+ name: logstash-devutils
59
62
  prerelease: false
60
63
  type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
61
69
  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
62
70
  email: info@elastic.co
63
71
  executables: []
64
72
  extensions: []
65
73
  extra_rdoc_files: []
66
74
  files:
67
- - .gitignore
68
75
  - CHANGELOG.md
69
76
  - CONTRIBUTORS
70
77
  - Gemfile
71
78
  - LICENSE
72
79
  - NOTICE.TXT
73
80
  - README.md
74
- - Rakefile
75
81
  - lib/logstash/inputs/snmptrap.rb
76
82
  - logstash-input-snmptrap.gemspec
77
83
  - spec/inputs/snmptrap_spec.rb
@@ -97,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
103
  version: '0'
98
104
  requirements: []
99
105
  rubyforge_project:
100
- rubygems_version: 2.2.2
106
+ rubygems_version: 2.4.8
101
107
  signing_key:
102
108
  specification_version: 4
103
109
  summary: Read snmp trap messages as events
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"