Files
oikos/scripts/report-stray-test-lxcs.sh
dtoro b87735a111
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
ci / web (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled
chore: graph view, dns-zone gap, fleet deploy/cleanup tooling
Graph view: raise the node cap 500 -> 2000 and exclude execution/task audit
rows from the default whole-graph view so the cap is spent on actual topology
rather than ~380 cognition records that crowded out every host/lxc/service.

dns-zone monitoring [dns] -> none: no dns checker exists, so the declaration
only produced unresolvable `unmonitored` noise (requires ontology re-ingest;
coverageSweep now auto-clears the stale signals). Flip back to [dns] when a
checker lands.

Operator tooling: tools/deploy-checks.sh pushes check scripts into guests via
pct push (a pct-exec-routed check runs the script INSIDE the guest), wired
into the post-pull setup-checks hook so guests stay in sync on Proxmox hosts;
scripts/cleanup-orphan-checks.sh (dry-run by default) and
report-stray-test-lxcs.sh retire legacy cruft. VERSION 0.13.0 -> 0.14.0.

Plan: plans/2026-07-29-health-check-reality-and-knowledge-graph.md.
2026-07-29 13:37:27 +02:00

32 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# report-stray-test-lxcs.sh — list leftover test/scratch LXC entities.
#
# Provisioning experiments leave active `lxc:test-*` / `lxc:preflight-*`
# entities in the graph long after the containers are gone or repurposed.
# They generate checks and pollute health/graph views. This reports them and
# their DB state + which Proxmox host each is parented on, so the operator can
# confirm the container is really gone and retire the entity via the
# lifecycle-destroy-node runbook (a destructive, approval-gated action).
#
# Read-only. Pair with: lifecycle-destroy-node (mark destroyed) or
# lifecycle-deprecate-node.
set -euo pipefail
PSQL_CMD="${OIKOS_PSQL:-docker exec -i oikos-postgres-1 psql -U oikos -d oikos}"
echo "== stray test/scratch LXC entities =="
$PSQL_CMD -F ' | ' -Ac "
SELECT e.slug, COALESCE(e.state,'active') AS state,
e.attributes->>'pve_id' AS pve_id,
COALESCE(h.slug,'(no host)') AS host
FROM entities e
LEFT JOIN relationships r ON r.target_id = e.id AND r.type='hosts' AND r.valid_to IS NULL
LEFT JOIN entities h ON h.id = r.source_id
WHERE e.type='lxc' AND e.slug ~ '^lxc:(test|preflight)'
ORDER BY e.slug;"
echo
echo "Next: for each, confirm the container is gone in Proxmox (pct list on its"
echo "host), then retire via lifecycle-destroy-node (destructive) or mark"
echo "deprecated. If a container still exists, pct destroy it first."