Class: Fluent::DfInput

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

Constant Summary collapse

EXPECTED_DF_OUTPUT_COLS_LENGTH =

filesystem, blocks, used, available, capacity, mounted on

6

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



15
16
17
18
# File 'lib/fluent/plugin/in_df.rb', line 15

def configure(conf)
  super
  @command = "df -P #{@option} #{@target_mounts} 2> /dev/null"
end

#runObject



36
37
38
39
40
# File 'lib/fluent/plugin/in_df.rb', line 36

def run
  @loop.run
rescue => e
  $log.error "#{e.class.name} - #{e.message}"
end

#shutdownObject



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

def shutdown
  super
  @loop.watchers.each { |w| w.detach }
  @loop.stop
  @thread.terminate
  @thread.join
end

#startObject



20
21
22
23
24
25
26
# File 'lib/fluent/plugin/in_df.rb', line 20

def start
  super
  @loop = Coolio::Loop.new
  @timer = DfInputTimerWatcher.new(@interval, true, &method(:watch))
  @loop.attach(@timer)
  @thread = Thread.new(&method(:run))
end