package agentapi import ( "context" "encoding/json" "fmt" ) // GuestOOMKillsState mirrors the agent's GET /guest/oom-kills (R-528, agent ≥ the R-528 commit): the kernel's oom_kill // counter of each of THIS guest's containers, read on the host — Docker's own OOMKilled flag can stay false inside an // LXC guest. Containers maps the full 64-hex container id to the count for the container's current run. // Available=false: the guest has no cgroup folder the host can read. An agent that predates the route answers 404 (a // *StatusError) — the controller then keeps Docker's flag only. type GuestOOMKillsState struct { VMID int `json:"vmid"` Available bool `json:"available"` Containers map[string]int64 `json:"containers"` } // GuestOOMKills calls GET /guest/oom-kills. func (c *Client) GuestOOMKills(ctx context.Context) (GuestOOMKillsState, error) { var out GuestOOMKillsState body, err := c.get(ctx, "/guest/oom-kills") if err != nil { return out, err } if err := json.Unmarshal(body, &out); err != nil { return out, fmt.Errorf("agentapi: decode /guest/oom-kills: %w", err) } return out, nil }