lib/fluent/plugin/in_dstat.rb in fluent-plugin-dstat-0.2.1 vs lib/fluent/plugin/in_dstat.rb in fluent-plugin-dstat-0.2.2
- old
+ new
@@ -5,11 +5,10 @@
Plugin.register_input('dstat', self)
def initialize
super
require 'csv'
- @hostname = `hostname -s`.chomp!
@line_number = 0
@first_keys = []
@second_keys = []
@data_array = []
@max_lines = 100
@@ -18,13 +17,15 @@
config_param :tag, :string
config_param :option, :string, :default => "-fcdnm"
config_param :delay, :integer, :default => 1
config_param :tmp_file, :string, :default => "/tmp/dstat.csv"
+ config_param :hostname_command, :string, :default => "hostname"
def configure(conf)
super
@command = "dstat #{@option} --output #{@tmp_file} #{@delay}"
+ @hostname = `#{@hostname_command}`.chomp!
end
def check_dstat
restart if (Time.now - @last_time) > @delay*3
end