Class: Fluent::Plugin::MonitorAgentInput::APIHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_monitor_agent.rb

Instance Method Summary collapse

Constructor Details

#initialize(agent) ⇒ APIHandler

Returns a new instance of APIHandler.



47
48
49
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 47

def initialize(agent)
  @agent = agent
end

Instance Method Details

#config_json(req) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 74

def config_json(req)
  obj = {
    'pid' => Process.pid,
    'ppid' => Process.ppid,
    'version' => Fluent::VERSION,
  }.merge(@agent.fluentd_opts)
  opts = build_option(req)

  render_json(obj, pretty_json: opts[:pretty_json])
end

#config_ltsv(_req) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 64

def config_ltsv(_req)
  obj = {
    'pid' => Process.pid,
    'ppid' => Process.ppid,
    'version' => Fluent::VERSION,
  }.merge(@agent.fluentd_opts)

  render_ltsv([obj])
end

#plugins_json(req) ⇒ Object



57
58
59
60
61
62
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 57

def plugins_json(req)
  opts = build_option(req)
  obj = build_object(opts)

  render_json({ 'plugins' => obj }, pretty_json: opts[:pretty_json])
end

#plugins_ltsv(req) ⇒ Object



51
52
53
54
55
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 51

def plugins_ltsv(req)
  list = build_object(build_option(req))

  render_ltsv(list)
end