Class: Fluentd::Agent::TdAgent

Inherits:
Object
  • Object
show all
Includes:
Common, LocalCommon
Defined in:
app/models/fluentd/agent/td_agent.rb

Instance Attribute Summary

Attributes included from Common

#extra_options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LocalCommon

#config, #config_append, #config_write, #configuration, #log, #log_tail, #running?

Methods included from Common

#config_file, #errors_since, #initialize, #log_file, #pid_file, #recent_errors, #wait_process_starting_seconds

Class Method Details

.default_optionsObject



7
8
9
10
11
12
13
# File 'app/models/fluentd/agent/td_agent.rb', line 7

def self.default_options
  {
    :pid_file => "/var/run/td-agent/td-agent.pid",
    :log_file => "/var/log/td-agent/td-agent.log",
    :config_file => "/etc/td-agent/td-agent.conf",
  }
end

Instance Method Details

#restartObject



23
24
25
26
27
# File 'app/models/fluentd/agent/td_agent.rb', line 23

def restart
  # NOTE: td-agent has no reload command
  # https://github.com/treasure-data/td-agent/blob/master/debian/td-agent.init#L156
  detached_command('/etc/init.d/td-agent restart')
end

#startObject



15
16
17
# File 'app/models/fluentd/agent/td_agent.rb', line 15

def start
  detached_command('/etc/init.d/td-agent start')
end

#stopObject



19
20
21
# File 'app/models/fluentd/agent/td_agent.rb', line 19

def stop
  detached_command('/etc/init.d/td-agent stop')
end

#versionObject



29
30
31
# File 'app/models/fluentd/agent/td_agent.rb', line 29

def version
  `/usr/sbin/td-agent --version`.strip
end