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.



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

def initialize(agent)
  @agent = agent
end

Instance Method Details

#config_json(req) ⇒ Object



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

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



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

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



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

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



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

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

  render_ltsv(list)
end