feat(agent): start Diagnostics.Writer when dump_dir is configured
This commit is contained in:
parent
3a32af4ff9
commit
2bb901873f
1 changed files with 6 additions and 1 deletions
|
|
@ -9,7 +9,9 @@ defmodule ProxmoxAgent.Application do
|
||||||
case load_config() do
|
case load_config() do
|
||||||
{:ok, cfg} ->
|
{:ok, cfg} ->
|
||||||
Logger.info("agent: starting with host_id=#{cfg.host_id}")
|
Logger.info("agent: starting with host_id=#{cfg.host_id}")
|
||||||
[{ProxmoxAgent.Reporter, cfg}]
|
:ok = ProxmoxAgent.Diagnostics.configure(cfg.dump_dir)
|
||||||
|
diagnostics_children(ProxmoxAgent.Diagnostics.dump_dir()) ++
|
||||||
|
[{ProxmoxAgent.Reporter, cfg}]
|
||||||
|
|
||||||
{:error, reason} ->
|
{:error, reason} ->
|
||||||
Logger.error("agent: no config loaded (#{inspect(reason)}); running in idle mode")
|
Logger.error("agent: no config loaded (#{inspect(reason)}); running in idle mode")
|
||||||
|
|
@ -19,6 +21,9 @@ defmodule ProxmoxAgent.Application do
|
||||||
Supervisor.start_link(children, strategy: :one_for_one, name: ProxmoxAgent.Supervisor)
|
Supervisor.start_link(children, strategy: :one_for_one, name: ProxmoxAgent.Supervisor)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp diagnostics_children(nil), do: []
|
||||||
|
defp diagnostics_children(dir), do: [{ProxmoxAgent.Diagnostics.Writer, [dir: dir]}]
|
||||||
|
|
||||||
defp load_config do
|
defp load_config do
|
||||||
path =
|
path =
|
||||||
System.get_env("AGENT_CONFIG") ||
|
System.get_env("AGENT_CONFIG") ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue