Class: Fluent::TopInput

Inherits:
Input
  • Object
show all
Includes:
Mixin::RewriteTagName
Defined in:
lib/fluent/plugin/in_top.rb

Constant Summary collapse

INTERVAL_MIN =

avoid too short interval

0.5

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



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

def configure(conf)
  super
  interval = @interval > INTERVAL_MIN ? @interval : INTERVAL_MIN
  @top_command =
    if @test_cmd then
      @test_cmd
    else
      "#{@top} -d #{interval} #{@command_line ? "-c" : ""} #{@extra_switch}"
    end
end

#shutdownObject



64
65
66
67
68
# File 'lib/fluent/plugin/in_top.rb', line 64

def shutdown
  super
  $log.trace "Shutdown top command thread."
  @top_thread.kill if @top_thread
end

#startObject



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

def start
  super
  @top_thread = Thread.new do
    run_top()
  end
end