Class: SarInput

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

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/fluent/plugin/in_sar.rb', line 10

def configure(conf)
    super
    @interval_m = @sar_option.split.size.zero? ? @interval * 60 : @interval * 60 - 1
    begin
       `sar -V`
       raise Fluent::ConfigError, "sar_option contains illegal characters.(sar_option: #{@sar_option})" if /[^a-zA-Z ]+/ =~ @sar_option
    rescue
       raise Fluent::ConfigError, "sar(sysstat) is not installed."
    end
end

#shutdownObject



26
27
28
# File 'lib/fluent/plugin/in_sar.rb', line 26

def shutdown
    @thread.kill
end

#startObject



21
22
23
24
# File 'lib/fluent/plugin/in_sar.rb', line 21

def start
    super
    @thread = Thread.new(&method(:run))
end