Class: Fluent::MuninNodeInput

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

Defined Under Namespace

Classes: TimerWatcher

Instance Method Summary collapse

Constructor Details

#initializeMuninNodeInput

Returns a new instance of MuninNodeInput.



29
30
31
32
# File 'lib/fluent/plugin/in_munin_node.rb', line 29

def initialize
  super
  require 'munin-ruby'
end

Instance Method Details

#configure(conf) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/fluent/plugin/in_munin_node.rb', line 34

def configure(conf)
  super

  @include_service = Regexp.new(@include_service) if @include_service
  @exclude_service = Regexp.new(@exclude_service) if @exclude_service

  if @include_hostname
    @extra.update(@hostname_key => hostname)
  end
end

#shutdownObject



54
55
56
57
58
59
60
# File 'lib/fluent/plugin/in_munin_node.rb', line 54

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

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

#startObject



45
46
47
48
49
50
51
52
# File 'lib/fluent/plugin/in_munin_node.rb', line 45

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