logstash-input-hpaapoll 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4b110b259ee5b32914c39f6044cd337ef433e7d8
4
+ data.tar.gz: 912c3081cec6b44915ae4bad0464587ec5e64d60
5
+ SHA512:
6
+ metadata.gz: 943ffcc102b7f5cddc44fa0dc8223a0c25e507039ce88aa3f5b71772cc5f76163536d19ef6c69b9a47375759ee241ee3619a8689d24bc1e8c5fc0dbc0ec14aea
7
+ data.tar.gz: 756f0b07c5b9df8ed132921364b96706cfab9f3df5266eb3f1a6888d91ea921acdd5befc4c20684eee5ce91802bf089111d3026d5594aa4a9c564cd7b946eeed
data/CHANGELOG.md ADDED
File without changes
data/DEVELOPER.md ADDED
@@ -0,0 +1,2 @@
1
+ # logstash-input-example
2
+ Example input plugin. This should help bootstrap your effort to write your own input plugin!
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ logstash-input-hpaapoll (0.1.0)
5
+ logstash-codec-plain
6
+ logstash-core (>= 1.4.0, < 2.0.0)
7
+ stud
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ cabin (0.7.1)
13
+ clamp (0.6.5)
14
+ coderay (1.1.0)
15
+ diff-lcs (1.2.5)
16
+ ffi (1.9.8-java)
17
+ filesize (0.0.4)
18
+ gem_publisher (1.5.0)
19
+ i18n (0.6.9)
20
+ insist (1.0.0)
21
+ jrjackson (0.2.8)
22
+ logstash-codec-plain (0.1.6)
23
+ logstash-core (>= 1.4.0, < 2.0.0)
24
+ logstash-core (1.5.0-java)
25
+ cabin (~> 0.7.0)
26
+ clamp (~> 0.6.5)
27
+ filesize (= 0.0.4)
28
+ i18n (= 0.6.9)
29
+ jrjackson (~> 0.2.8)
30
+ minitar (~> 0.5.4)
31
+ pry (~> 0.10.1)
32
+ stud (~> 0.0.19)
33
+ treetop (< 1.5.0)
34
+ logstash-devutils (0.0.14-java)
35
+ gem_publisher
36
+ insist (= 1.0.0)
37
+ minitar
38
+ rake
39
+ rspec (~> 3.1.0)
40
+ method_source (0.8.2)
41
+ minitar (0.5.4)
42
+ polyglot (0.3.5)
43
+ pry (0.10.1-java)
44
+ coderay (~> 1.1.0)
45
+ method_source (~> 0.8.1)
46
+ slop (~> 3.4)
47
+ spoon (~> 0.0)
48
+ rake (10.4.2)
49
+ rspec (3.1.0)
50
+ rspec-core (~> 3.1.0)
51
+ rspec-expectations (~> 3.1.0)
52
+ rspec-mocks (~> 3.1.0)
53
+ rspec-core (3.1.7)
54
+ rspec-support (~> 3.1.0)
55
+ rspec-expectations (3.1.2)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.1.0)
58
+ rspec-mocks (3.1.3)
59
+ rspec-support (~> 3.1.0)
60
+ rspec-support (3.1.2)
61
+ slop (3.6.0)
62
+ spoon (0.0.4)
63
+ ffi
64
+ stud (0.0.19)
65
+ treetop (1.4.15)
66
+ polyglot
67
+ polyglot (>= 0.3.1)
68
+
69
+ PLATFORMS
70
+ java
71
+
72
+ DEPENDENCIES
73
+ logstash-devutils
74
+ logstash-input-hpaapoll!
75
+
76
+ BUNDLED WITH
77
+ 1.10.3
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # Logstash Plugin
2
+
3
+ This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
4
+
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
+
7
+ ## Documentation
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/).
10
+
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
13
+
14
+ ## Need Help?
15
+
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
+
18
+ ## Developing
19
+
20
+ ### 1. Plugin Developement and Testing
21
+
22
+ #### Code
23
+ - To get started, you'll need JRuby with the Bundler gem installed.
24
+
25
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
26
+
27
+ - Install dependencies
28
+ ```sh
29
+ bundle install
30
+ ```
31
+
32
+ #### Test
33
+
34
+ - Update your dependencies
35
+
36
+ ```sh
37
+ bundle install
38
+ ```
39
+
40
+ - Run tests
41
+
42
+ ```sh
43
+ bundle exec rspec
44
+ ```
45
+
46
+ ### 2. Running your unpublished Plugin in Logstash
47
+
48
+ #### 2.1 Run in a local Logstash clone
49
+
50
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
51
+ ```ruby
52
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
53
+ ```
54
+ - Install plugin
55
+ ```sh
56
+ bin/plugin install --no-verify
57
+ ```
58
+ - Run Logstash with your plugin
59
+ ```sh
60
+ bin/logstash -e 'filter {awesome {}}'
61
+ ```
62
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
63
+
64
+ #### 2.2 Run in an installed Logstash
65
+
66
+ You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
67
+
68
+ - Build your plugin gem
69
+ ```sh
70
+ gem build logstash-filter-awesome.gemspec
71
+ ```
72
+ - Install the plugin from the Logstash home
73
+ ```sh
74
+ bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
75
+ ```
76
+ - Start Logstash and proceed to test the plugin
77
+
78
+ ## Contributing
79
+
80
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
81
+
82
+ Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
83
+
84
+ It is more important to the community that you are able to contribute.
85
+
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rake"
@@ -0,0 +1,76 @@
1
+ # encoding: utf-8
2
+ require "logstash/inputs/base"
3
+ require "logstash/namespace"
4
+
5
+ # Read events over HTTP requests.
6
+ #
7
+ class LogStash::Inputs::HPArcSightAppliancePoll < LogStash::Inputs::Base
8
+ config_name "hpaapoll"
9
+
10
+ default :codec, "plain"
11
+
12
+ config :host, :validate => :string, :required => true
13
+
14
+ config :interval, :validate => :number, :default => 600
15
+
16
+ config :port, :validate => :number, :default => 161
17
+
18
+ config :community, :validate => :string, :default => "public"
19
+
20
+ config :mibdir, :validate => :string, :default => "/usr/share/snmp/mibs"
21
+
22
+ config :tag_on_exception, :validate => :string, :default => "exception"
23
+
24
+ def initialize(*args)
25
+ super(*args)
26
+ end # def initialize
27
+
28
+ public
29
+ def register
30
+ require 'snmp'
31
+ require 'json'
32
+
33
+ @@oid = '1.3.6.1.4.1.11937.3.1'
34
+ @manager = SNMP::Manager.new(:host => @host, :port => @port, :community => @community, :mib_dir => @mibdir)
35
+ @logger.info("Manager", :manager => @manager)
36
+ @names = [ nil, nil, 'name', 'location', 'type', 'value', 'status']
37
+
38
+ end # def register
39
+
40
+ public
41
+ def run(queue)
42
+ while true
43
+ begin
44
+ sensors = Hash.new()
45
+
46
+ @manager.walk(@@oid) { |vb|
47
+ @logger.info(:VarBind => vb)
48
+ if vb.name[-2] == 1
49
+ sensors[vb.name[-1]] = { 'index' => vb.value }
50
+ else
51
+ sensors[vb.name[-1]][@names[vb.name[-2]]] = vb.value
52
+ end
53
+ }
54
+
55
+ sensors.each do |index, sensor|
56
+ event = LogStash::Event.new()
57
+ decorate(event)
58
+ event['host'] = @host
59
+ sensor['host'] = @host
60
+ sensor['community'] = @community
61
+ sensor['port'] = @port
62
+ event['sensor'] = sensor
63
+ event['message'] = sensor.to_s
64
+ queue << event
65
+ end
66
+ rescue SocketError => e
67
+ event = LogStash::Event.new()
68
+ decorate(event)
69
+ event['host'] = @host
70
+ event[@tag_on_exception] = e unless @tag_on_exception.empty?
71
+ queue << event
72
+ end
73
+ sleep(@interval)
74
+ end # while true
75
+ end # def run
76
+ end # class
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-input-hpaapoll'
3
+ s.version = '0.1.0'
4
+ s.licenses = ['Apache License (2.0)']
5
+ s.summary = "This input polls SNMP of HP ArcSight Appliances."
6
+ 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"
7
+ s.authors = ["ThetaPoint"]
8
+ s.email = 'info@theta-point.com'
9
+ s.homepage = "http://www.theta-point.com"
10
+ s.require_paths = ["lib"]
11
+
12
+ # Files
13
+ s.files = `git ls-files`.split($\)
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
19
+
20
+ # Gem dependencies
21
+ s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
22
+ s.add_runtime_dependency 'logstash-codec-plain'
23
+ s.add_runtime_dependency 'stud'
24
+ s.add_development_dependency 'logstash-devutils'
25
+ end
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rspec/spec_helper"
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-input-hpaapoll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ThetaPoint
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.4.0
28
+ - - <
29
+ - !ruby/object:Gem::Version
30
+ version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
33
+ - !ruby/object:Gem::Dependency
34
+ name: logstash-codec-plain
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ prerelease: false
46
+ type: :runtime
47
+ - !ruby/object:Gem::Dependency
48
+ name: stud
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ prerelease: false
60
+ type: :runtime
61
+ - !ruby/object:Gem::Dependency
62
+ name: logstash-devutils
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirement: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ prerelease: false
74
+ type: :development
75
+ 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
76
+ email: info@theta-point.com
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - CHANGELOG.md
82
+ - DEVELOPER.md
83
+ - Gemfile
84
+ - Gemfile.lock
85
+ - LICENSE
86
+ - README.md
87
+ - Rakefile
88
+ - lib/logstash/inputs/hpaapoll.rb
89
+ - logstash-input-hpaapoll.gemspec
90
+ - spec/inputs/hpaapoll_spec.rb
91
+ homepage: http://www.theta-point.com
92
+ licenses:
93
+ - Apache License (2.0)
94
+ metadata:
95
+ logstash_plugin: 'true'
96
+ logstash_group: input
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.4.5
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: This input polls SNMP of HP ArcSight Appliances.
117
+ test_files:
118
+ - spec/inputs/hpaapoll_spec.rb