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



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

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

#runObject



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

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

#shutdownObject



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

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

#startObject



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

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