Repository Public
1\pset format unaligned2\pset fieldsep ' | '3\echo == node4select alias, kind, hostname, model, chip, arch, cpu_cores, cpu_levels, gpu_cores, round(mem_bytes/1073741824.0,1) as mem_gib, round(storage_bytes/1e9) as storage_gb, os_name, os_version, os_build, registered_via, inventory->'managers' as managers, inventory->'laptop' as laptop, last_seen_at from nodes;5\echo == agents6select id, version, capabilities, last_seq, overhead, revoked_at is not null as revoked, revoked_reason, cert_not_after from agents order by enrolled_at;7\echo == samples per metric (raw)8select c.name, count(*) as n, count(distinct s.label) as labels, min(s.ts) as first, max(s.ts) as last, round(avg(s.value)::numeric,2) as avg from samples_raw s join metric_catalog c on c.id = s.metric_id group by c.name order by c.name;9\echo == availability map10select availability, ts from node_state;11\echo == services by manager12select manager, state, count(*) from services where gone_at is null group by 1,2 order by 1,2;13\echo == top processes14select p->>'name' as name, p->>'pid' as pid, p->>'user' as usr, round((p->>'cpu')::numeric,1) as cpu, round((p->>'rss')::numeric/1048576,1) as rss_mib from node_state, jsonb_array_elements(processes) p limit 15;15\echo == rollups16select (select count(*) from samples_raw) as raw, (select count(*) from samples_1m) as m1, (select count(distinct ts) from samples_1m) as minutes, (select count(*) from samples_1h) as h1;17select tier, watermark from rollup_state;18select c.name, s.label, s.ts, round(s.avg::numeric,2) avg, round(s.min::numeric,2) min, round(s.max::numeric,2) max, s.n from samples_1m s join metric_catalog c on c.id=s.metric_id where c.name in ('cpu.usage','mem.used','gpu.usage') order by s.ts desc, c.name limit 6;19\echo == agent overhead (measured by the agent on itself)20select c.name, count(*) n, round(avg(value)::numeric,3) avg, round(max(value)::numeric,3) max from samples_raw s join metric_catalog c on c.id=s.metric_id where c.name in ('agent.cpu','agent.rss') group by 1;21\echo == volumes / inference / audit / heartbeat22select mount, kind, fs, round(total_bytes/1e9,1) total_gb, round(used_bytes/1e9,1) used_gb, smart_status from volumes where gone_at is null;23select count(*) as inference_servers from inference_servers where gone_at is null;24select seq, action, actor_kind, outcome, detail from audit_log order by seq;25select service, version, detail->'connected_agents' from service_heartbeats;26