logstash-input-wmi 0.1.1-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 +7 -0
- data/.gitignore +4 -0
- data/Gemfile +3 -0
- data/LICENSE +13 -0
- data/Rakefile +7 -0
- data/lib/logstash/inputs/wmi.rb +71 -0
- data/logstash-input-wmi.gemspec +31 -0
- data/spec/inputs/wmi_spec.rb +5 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7ec1646258d917811fa55b6dd79fe42563441fd5
|
4
|
+
data.tar.gz: ecdc995a94a7b247e37a71fdf5da031f3f5e5096
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 51eb2a03fd1a277b08e67f06b21060a5df609f31f5257c727468b9c0f26f22d4a9f9c7c33e1616b4575423d780441b53415977a51757f67825bcfc22b3113b56
|
7
|
+
data.tar.gz: 079b7a874a997cc3832a8f5c60c7b0346145c901e9937892ad7a3e6ebaf3d0aa004a75d164b365db2e0ce02801744a2445f5bb9d6758922b3fd074b7ed0b8471
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2012-2014 Elasticsearch <http://www.elasticsearch.org>
|
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/Rakefile
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/inputs/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
require "socket"
|
5
|
+
|
6
|
+
|
7
|
+
# Collect data from WMI query
|
8
|
+
#
|
9
|
+
# This is useful for collecting performance metrics and other data
|
10
|
+
# which is accessible via WMI on a Windows host
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
# [source,ruby]
|
14
|
+
# input {
|
15
|
+
# wmi {
|
16
|
+
# query => "select * from Win32_Process"
|
17
|
+
# interval => 10
|
18
|
+
# }
|
19
|
+
# wmi {
|
20
|
+
# query => "select PercentProcessorTime from Win32_PerfFormattedData_PerfOS_Processor where name = '_Total'"
|
21
|
+
# }
|
22
|
+
# }
|
23
|
+
class LogStash::Inputs::WMI < LogStash::Inputs::Base
|
24
|
+
|
25
|
+
config_name "wmi"
|
26
|
+
milestone 1
|
27
|
+
|
28
|
+
# WMI query
|
29
|
+
config :query, :validate => :string, :required => true
|
30
|
+
# Polling interval
|
31
|
+
config :interval, :validate => :number, :default => 10
|
32
|
+
|
33
|
+
public
|
34
|
+
def register
|
35
|
+
|
36
|
+
@host = Socket.gethostname
|
37
|
+
@logger.info("Registering wmi input", :query => @query)
|
38
|
+
|
39
|
+
if RUBY_PLATFORM == "java"
|
40
|
+
require "jruby-win32ole"
|
41
|
+
else
|
42
|
+
require "win32ole"
|
43
|
+
end
|
44
|
+
end # def register
|
45
|
+
|
46
|
+
public
|
47
|
+
def run(queue)
|
48
|
+
@wmi = WIN32OLE.connect("winmgmts://")
|
49
|
+
|
50
|
+
begin
|
51
|
+
@logger.debug("Executing WMI query '#{@query}'")
|
52
|
+
loop do
|
53
|
+
@wmi.ExecQuery(@query).each do |wmiobj|
|
54
|
+
# create a single event for all properties in the collection
|
55
|
+
event = LogStash::Event.new
|
56
|
+
event["host"] = @host
|
57
|
+
decorate(event)
|
58
|
+
wmiobj.Properties_.each do |prop|
|
59
|
+
event[prop.name] = prop.value
|
60
|
+
end
|
61
|
+
queue << event
|
62
|
+
end
|
63
|
+
sleep @interval
|
64
|
+
end # loop
|
65
|
+
rescue Exception => ex
|
66
|
+
@logger.error("WMI query error: #{ex}\n#{ex.backtrace}")
|
67
|
+
sleep @interval
|
68
|
+
retry
|
69
|
+
end # begin/rescue
|
70
|
+
end # def run
|
71
|
+
end # class LogStash::Inputs::WMI
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
|
3
|
+
s.name = 'logstash-input-wmi'
|
4
|
+
s.version = '0.1.1'
|
5
|
+
s.licenses = ['Apache License (2.0)']
|
6
|
+
s.summary = "Collect data from WMI query"
|
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"
|
8
|
+
s.authors = ["Elasticsearch"]
|
9
|
+
s.email = 'info@elasticsearch.com'
|
10
|
+
s.homepage = "http://www.elasticsearch.org/guide/en/logstash/current/index.html"
|
11
|
+
s.require_paths = ["lib"]
|
12
|
+
|
13
|
+
# Files
|
14
|
+
s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
|
15
|
+
|
16
|
+
# Tests
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
|
19
|
+
# Special flag to let us know this is actually a logstash plugin
|
20
|
+
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
21
|
+
|
22
|
+
# Gem dependencies
|
23
|
+
s.add_runtime_dependency 'logstash', '>= 1.4.0', '< 2.0.0'
|
24
|
+
|
25
|
+
if RUBY_PLATFORM == 'java'
|
26
|
+
s.platform = RUBY_PLATFORM
|
27
|
+
s.add_runtime_dependency "jruby-win32ole" #(unknown license)
|
28
|
+
end
|
29
|
+
s.add_development_dependency 'logstash-devutils'
|
30
|
+
end
|
31
|
+
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-input-wmi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: java
|
6
|
+
authors:
|
7
|
+
- Elasticsearch
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash
|
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: jruby-win32ole
|
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: logstash-devutils
|
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: :development
|
61
|
+
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
|
+
email: info@elasticsearch.com
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- .gitignore
|
68
|
+
- Gemfile
|
69
|
+
- LICENSE
|
70
|
+
- Rakefile
|
71
|
+
- lib/logstash/inputs/wmi.rb
|
72
|
+
- logstash-input-wmi.gemspec
|
73
|
+
- spec/inputs/wmi_spec.rb
|
74
|
+
homepage: http://www.elasticsearch.org/guide/en/logstash/current/index.html
|
75
|
+
licenses:
|
76
|
+
- Apache License (2.0)
|
77
|
+
metadata:
|
78
|
+
logstash_plugin: 'true'
|
79
|
+
logstash_group: input
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.2.2
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Collect data from WMI query
|
100
|
+
test_files:
|
101
|
+
- spec/inputs/wmi_spec.rb
|