chore(agent): log /proc reads, log diagnostics enable, comment trap_exit

Addresses final code review:
- Host collector's /proc reads now go through Diagnostics.log_read/3,
  appearing in commands.log formatted as `$ cat /proc/loadavg`
- configure/1 logs an info line on successful enable so the operator
  has a breadcrumb in the journal
- Writer.init/1 documents the deliberate trap_exit omission
This commit is contained in:
Carsten 2026-04-22 22:29:26 +02:00
parent 2bb901873f
commit 3367b95b91
4 changed files with 34 additions and 3 deletions

View file

@ -96,5 +96,15 @@ defmodule ProxmoxAgent.DiagnosticsTest do
assert body =~ "kind=fast"
assert body =~ "\"zfs_pools\""
end
test "log_read/3 writes to commands.log formatted as cat", %{dir: dir} do
assert :ok = Diagnostics.log_read("/proc/loadavg", {:ok, "0.12 0.34 0.56 1/200 3000"}, 150)
:ok = GenServer.call(ProxmoxAgent.Diagnostics.Writer, :flush)
body = File.read!(Path.join(dir, "commands.log"))
assert body =~ "$ cat /proc/loadavg"
assert body =~ "0.12 0.34 0.56"
assert body =~ "exit=0"
end
end
end