Class: Fluentd::Agent::FluentdGem
- Inherits:
-
Object
- Object
- Fluentd::Agent::FluentdGem
show all
- Includes:
- Common
- Defined in:
- app/models/fluentd/agent/fluentd_gem.rb
Instance Attribute Summary
Attributes included from Common
#extra_options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Common
#backup_files, #backup_files_in_new_order, #backup_files_in_old_order, #config, #config_append, #config_backup_dir, #config_file, #config_merge, #config_write, #configuration, included, #initialize, #log, #log_file, #pid_file, #running_config_backup_dir, #running_config_backup_file
Class Method Details
.default_options ⇒ Object
6
7
8
9
10
11
12
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 6
def self.default_options
{
:pid_file => "#{ENV["HOME"]}/.fluentd-ui/fluent.pid",
:log_file => "#{ENV["HOME"]}/.fluentd-ui/fluent.log",
:config_file => "#{ENV["HOME"]}/.fluentd-ui/fluent.conf",
}
end
|
Instance Method Details
#config_syntax_check ⇒ Object
48
49
50
51
52
53
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 48
def config_syntax_check
Fluent::Config::V1Parser.parse(params[:config], config_file)
true
rescue Fluent::ConfigParseError
false
end
|
#dryrun!(file_path = nil) ⇒ Object
44
45
46
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 44
def dryrun!(file_path = nil)
exec_dryrun("fluentd", file_path)
end
|
#reload ⇒ Object
39
40
41
42
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 39
def reload
return false unless running?
actual_reload
end
|
#restart ⇒ Object
return value is status_after_this_method_called == started
30
31
32
33
34
35
36
37
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 30
def restart
if running?
validate_fluentd_options && stop && start
else
start
end
end
|
#start ⇒ Object
return value is status_after_this_method_called == started
15
16
17
18
19
20
21
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 15
def start
return true if running?
backup_running_config do
actual_start
end
end
|
#stop ⇒ Object
return value is status_after_this_method_called == stopped
24
25
26
27
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 24
def stop
return true unless running?
actual_stop
end
|
#version ⇒ Object
55
56
57
58
59
|
# File 'app/models/fluentd/agent/fluentd_gem.rb', line 55
def version
Bundler.with_clean_env do
`fluentd --version`.strip
end
end
|