Files
felhom.eu/documentation/audits/sizing-2026-10-13/tools/host_sampler.sh
T
admin c885b5acf4 Audit: what a Felhom box needs — floor, 64 apps' memory and CPU, power (N100 bench); R-993..R-995; R-231 due check read green
Measured on demo-felhom (N100, 16 GB): 61 apps deployed and removed through the
product, sampled every 5 s; heavy apps with one real action (Immich 200 photos,
Jellyfin transcode, Paperless OCR, Nextcloud 500 MB, ...). sizing.json for the
estimator (tools/build_sizing.py), SIZING.md with the proposed minimum machine,
METHOD.md. Power is RAPL CPU-package only (no meter). R-993 asks the operator to
approve the minimum machine; R-994 lists catalog limits/requests that are too low;
R-995 records leftover unnamed volumes after removal. R-231's dated check measured:
dooplex-backup.service success, journal green.
2026-10-13 13:23:51 +02:00

19 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# host_sampler.sh TAG [VMID] — runs on the Proxmox HOST. Every 5 s:
# ts rapl_pkg_uj mem_total_kb mem_available_kb guest_mem_current guest_anon pkg_temp_mC cpu_busy_jiffies cpu_total_jiffies
# rapl_pkg_uj = Intel RAPL package energy counter (CPU package only — NOT wall power).
# Stops when /root/sizing/stop-TAG exists. Read-only: it writes only its own TSV.
TAG=${1:?tag}; VMID=${2:-9201}; D=/root/sizing; mkdir -p "$D"; OUT="$D/host-$TAG.tsv"; rm -f "$D/stop-$TAG"
R=/sys/class/powercap/intel-rapl:0/energy_uj; CG=/sys/fs/cgroup/lxc/$VMID
T=$(for h in /sys/class/hwmon/hwmon*; do [ "$(cat $h/name)" = coretemp ] && echo $h/temp1_input; done | head -1)
echo -e "ts\trapl_pkg_uj\tmem_total_kb\tmem_available_kb\tguest_mem_current\tguest_anon\tpkg_temp_mC\tcpu_busy\tcpu_total" > "$OUT"
while [ ! -e "$D/stop-$TAG" ]; do
now=$(date +%s); e=$(cat $R 2>/dev/null || echo 0)
mt=$(awk '/^MemTotal/{print $2}' /proc/meminfo); ma=$(awk '/^MemAvailable/{print $2}' /proc/meminfo)
gc=$(cat $CG/memory.current 2>/dev/null || echo 0); ga=$(awk '$1=="anon"{print $2}' $CG/memory.stat 2>/dev/null)
t=$(cat "$T" 2>/dev/null || echo 0)
read -r busy total < <(awk '/^cpu /{b=$2+$3+$4+$7+$8+$9; t=b+$5+$6; print b,t}' /proc/stat)
echo -e "$now\t$e\t$mt\t$ma\t$gc\t${ga:-0}\t$t\t$busy\t$total" >> "$OUT"
sleep 5
done