Class: Fluent::JmxInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_jmx.rb

Defined Under Namespace

Classes: TimerWatcher

Instance Method Summary collapse

Constructor Details

#initializeJmxInput

Returns a new instance of JmxInput.



17
18
19
20
21
22
# File 'lib/fluent/plugin/in_jmx.rb', line 17

def initialize
  super
  require 'net/http'
  require 'uri'
  require 'json'
end

Instance Method Details

#configure(conf) ⇒ Object



24
25
26
# File 'lib/fluent/plugin/in_jmx.rb', line 24

def configure(conf)
  super
end

#runObject



41
42
43
44
45
46
# File 'lib/fluent/plugin/in_jmx.rb', line 41

def run
  @loop.run
rescue => e
  @log.error 'unexpected error', error: e.to_s
  @log.error_backtrace
end

#shutdownObject



35
36
37
38
39
# File 'lib/fluent/plugin/in_jmx.rb', line 35

def shutdown
  @tw.detach
  @loop.stop
  @thread.join
end

#startObject



28
29
30
31
32
33
# File 'lib/fluent/plugin/in_jmx.rb', line 28

def start
  @loop = Coolio::Loop.new
  @tw = TimerWatcher.new(interval, true, log, &method(:execute))
  @tw.attach(@loop)
  @thread = Thread.new(&method(:run))
end