logstash-input-perfmon 0.1.5 → 0.1.6
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/README.md +1 -1
- data/lib/logstash/inputs/perfmon.rb +3 -3
- data/lib/logstash/inputs/perfmon_proc_getter.rb +19 -11
- data/lib/logstash/inputs/typeperf_wrapper.rb +3 -3
- data/logstash-input-perfmon.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68cc247a345a96ce083538b3e7f661ab7a81b151
|
4
|
+
data.tar.gz: f27f18efd369769692d7ec7f3b0b1856eb497a70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc35795a90643171fbd743d2691eb59d0cfa51c259e8e3af5acc64fa23c6cce2de03d8c5e08c8feebf25a6df52863abfbc9675605219fc9ca36007f14d56f176
|
7
|
+
data.tar.gz: 4a91279ddd0072c9d445281bff0728c1df4762b414b60285ef1ab2ebc08dc58691a5a03465ff1aa3d6e3b3493fba95a708cb578c8570c6b8bacc782a762985e9
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ plugin install path\to\gem
|
|
32
32
|
If you aren't building the gem yourself, you can install it directly from rubygems.org:
|
33
33
|
```
|
34
34
|
cd path\to\logstash\bin
|
35
|
-
plugin install
|
35
|
+
plugin install logstash-input-perfmon
|
36
36
|
```
|
37
37
|
|
38
38
|
Create a configuration file. The following collects three metrics every ten seconds:
|
@@ -67,7 +67,7 @@ class LogStash::Inputs::Perfmon < LogStash::Inputs::Base
|
|
67
67
|
# [queue] The queue to add new events to
|
68
68
|
def run(queue)
|
69
69
|
@typeperf.start_monitor
|
70
|
-
|
70
|
+
|
71
71
|
@logger.debug("Started perfmon monitor")
|
72
72
|
|
73
73
|
while @typeperf.alive?
|
@@ -75,9 +75,9 @@ class LogStash::Inputs::Perfmon < LogStash::Inputs::Base
|
|
75
75
|
|
76
76
|
@codec.decode(data) do |event|
|
77
77
|
decorate(event)
|
78
|
-
|
78
|
+
|
79
79
|
event['host'] = @host
|
80
|
-
|
80
|
+
|
81
81
|
queue << event
|
82
82
|
@logger.debug("Added event to queue: #{event}")
|
83
83
|
end
|
@@ -14,19 +14,18 @@ class PerfmonProcGetter
|
|
14
14
|
# [output_queue] The queue to add each new message to
|
15
15
|
def start_process(counters, interval, output_queue)
|
16
16
|
cmd = get_typeperf_command(counters, interval)
|
17
|
-
|
18
|
-
|
17
|
+
|
18
|
+
Open3.popen3(cmd) do |w, r, e, thr|
|
19
|
+
|
20
|
+
wait_for_process_id_to_be_set(thr)
|
21
|
+
|
19
22
|
while line = r.gets
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
next if counters.any? { |counter| line.include? counter } # don't show lines that contain headers
|
25
|
-
line.gsub!('"', '') # remove quotes
|
26
|
-
line.strip!
|
27
|
-
output_queue << line
|
23
|
+
next if counters.any? { |counter| line.include? counter } # don't show lines that contain headers
|
24
|
+
line.gsub!('"', '') # remove quotes
|
25
|
+
line.strip!
|
26
|
+
output_queue << line
|
28
27
|
end
|
29
|
-
|
28
|
+
end
|
30
29
|
end
|
31
30
|
|
32
31
|
# Kills the typeperf process
|
@@ -73,4 +72,13 @@ class PerfmonProcGetter
|
|
73
72
|
def wait_for_process_to_start
|
74
73
|
sleep 0.5 until proc_is_running?
|
75
74
|
end
|
75
|
+
|
76
|
+
# Waits until the PID is set
|
77
|
+
# [thr] The object containing process info like the PID
|
78
|
+
def wait_for_process_id_to_be_set(thr)
|
79
|
+
while @pid.nil?
|
80
|
+
@pid = thr.pid
|
81
|
+
sleep 0.5
|
82
|
+
end
|
83
|
+
end
|
76
84
|
end
|
@@ -41,10 +41,10 @@ class TypeperfWrapper
|
|
41
41
|
|
42
42
|
# Waits until a new message is put onto the queue, then returns it
|
43
43
|
def get_next
|
44
|
-
while @msg_queue.empty?
|
44
|
+
while alive? && @msg_queue.empty?
|
45
45
|
sleep 0.5
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
@msg_queue.pop
|
49
49
|
end
|
50
50
|
|
@@ -55,7 +55,7 @@ class TypeperfWrapper
|
|
55
55
|
Thread.new do
|
56
56
|
@perfmon_proc_getter.start_process(@counters, @interval, @msg_queue)
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
@perfmon_proc_getter.wait_for_process_to_start
|
60
60
|
end
|
61
61
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-perfmon'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.6'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "Logstash input for Windows Performance Monitor"
|
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/plugin install gemname. This gem is not a stand-alone program. Logstash input for Windows Performance Monitor metrics."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-perfmon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Ramirez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|