logstash-input-perfmon 0.1.5 → 0.1.6

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: ce15adf592fe00372c2a7a6ce1096061e3ec3eeb
4
- data.tar.gz: 8089cc9ae91769a6cd7302718a842ed8e7ec1896
3
+ metadata.gz: 68cc247a345a96ce083538b3e7f661ab7a81b151
4
+ data.tar.gz: f27f18efd369769692d7ec7f3b0b1856eb497a70
5
5
  SHA512:
6
- metadata.gz: e9e551be0c097c1c7354c7ad2a12ea7a586a434e8ef0a489ee69f47c1512ff55d628ab4eba0d667dbb7fba7c06afb0044dfeed1afb8f44f8cb0766427cafa43d
7
- data.tar.gz: f18d9108332f3cfd195f6b776c67d77ed11d6b68aa0259f6a5b444e28bbc25b0aa493ac3a37525caf40f5b06018d5cfc6d2d084031874a6bf5c9365580b07fa3
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 logstah-input-perfmon
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
- Open3.popen3(cmd) do |w, r, e, thr|
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
- if @pid.nil?
21
- @pid = thr.pid
22
- end
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
- end
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.5'
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.5
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-16 00:00:00.000000000 Z
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