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.



45
46
47
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 45

def initialize(agent)
  @agent = agent
end

Instance Method Details

#config_json(req) ⇒ Object



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

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



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

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



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

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



49
50
51
52
53
# File 'lib/fluent/plugin/in_monitor_agent.rb', line 49

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

  render_ltsv(list)
end