Class: Fluent::ZabbixAgentInput

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

Defined Under Namespace

Classes: TimerWatcher

Instance Method Summary collapse

Constructor Details

#initializeZabbixAgentInput

Returns a new instance of ZabbixAgentInput.



14
15
16
17
18
19
20
21
22
# File 'lib/fluent/plugin/in_zabbix_agent.rb', line 14

def initialize
  super
  require 'csv'
  require 'fileutils'
  require 'logger'
  require 'time'
  require 'addressable/uri'
  require 'aws-sdk'
end

Instance Method Details

#configure(conf) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/fluent/plugin/in_zabbix_agent.rb', line 38

def configure(conf)
  super

  @items.keys.each do |key|
    value = @items[key]
    @items[key] = key if value.nil?
  end
end

#shutdownObject



56
57
58
59
60
61
62
# File 'lib/fluent/plugin/in_zabbix_agent.rb', line 56

def shutdown
  @loop.watchers.each(&:detach)
  @loop.stop

  # XXX: Comment out for exit soon. Is it OK?
  #@thread.join
end

#startObject



47
48
49
50
51
52
53
54
# File 'lib/fluent/plugin/in_zabbix_agent.rb', line 47

def start
  super

  @loop = Coolio::Loop.new
  timer = TimerWatcher.new(@interval, true, log, &method(:fetch_items))
  @loop.attach(timer)
  @thread = Thread.new(&method(:run))
end