Class: Fluent::FreeInput
- Inherits:
-
Input
- Object
- Input
- Fluent::FreeInput
- Defined in:
- lib/fluent/plugin/in_free.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fluent/plugin/in_free.rb', line 10 def configure(conf) super if @interval @tick = interval.to_i else @tick = 10 end @option = case @unit when 'byte' then '-b' when 'kilo' then '-k' when 'mega' then '-m' when 'giga' then '-g' else raise RuntimeError, "@unit must be one of byte/kilo/mega/giga" end end |
#run ⇒ Object
38 39 40 41 42 43 |
# File 'lib/fluent/plugin/in_free.rb', line 38 def run loop do Fluent::Engine.emit(@tag, Fluent::Engine.now, get_free_info) sleep @tick end end |
#shutdown ⇒ Object
33 34 35 36 |
# File 'lib/fluent/plugin/in_free.rb', line 33 def shutdown @thread.terminate @thread.join end |
#start ⇒ Object
28 29 30 31 |
# File 'lib/fluent/plugin/in_free.rb', line 28 def start super @thread = Thread.new(&method(:run)) end |