Files
PFVCluster/perf/install-utils.sh
T
mrcharles 4851517947 refactor: reorganize merged repo into clean directory structure
Reorganize the merged KNELServerBuild + PFVCluster repo:

  provisioning/    server provisioning (was ProjectCode/ +
                   Project-Includes/ + Project-ConfigFiles/)
  tests/           test suite (was Project-Tests/)
  perf/            Proxmox perf scripts (was top-level *.sh + scripts/)
  docs/            all documentation (was ProjectDocs/ + PROJECT.md +
                   K8S.md + TODO.md)
  dns-cluster-setup/  Technitium DNS cluster (unchanged)
  netinfra/        netinfra audit scripts (unchanged)
  switches/        switch configs (unchanged)
  vendor/          vendored KNELShellFramework (unchanged)

Update all internal path references from old directory names
(ProjectCode/, Project-Includes/, Project-Tests/) to the new ones
(provisioning/, tests/) across all scripts.

🤖 Generated with [Crush](https://github.com/charmassociates/crush)

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-07-28 11:24:39 -05:00

61 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# install-utils.sh - installs useful observability packages on a host.
# These are all small, dependency-light, and read-only at runtime.
set -uo pipefail
SSH_OPTS=(-o BatchMode=yes -o ConnectTimeout=8 -o StrictHostKeyChecking=accept-new)
HOSTS=(pfv-tsys6 pfv-tsys7)
# Packages to install, with rationale
PKGS=(
sysstat # sar, iostat, mpstat, pidstat - the missing observability suite
jq # JSON parsing for pvesh/scripts
numactl # NUMA topology/controls for the dual-socket hosts
nvme-cli # NVMe health (for when NVMe shows up)
tcpdump # packet capture for network debugging
mtr-tiny # traceroute on steroids
nstat # kernel SNMP stats (already partly there)
dnsutils # dig, nslookup, host
bmon # bandwidth monitor ( curses, real-time)
)
for host in "${HOSTS[@]}"; do
echo "================================================================"
echo "[$host] installing observability packages"
echo "================================================================"
if ! ssh "${SSH_OPTS[@]}" "root@$host" 'echo ok' >/dev/null 2>&1; then
echo " UNREACHABLE"
continue
fi
# Check which are missing
missing=""
for pkg in "${PKGS[@]}"; do
if ! ssh "${SSH_OPTS[@]}" "root@$host" "dpkg -s $pkg 2>/dev/null | grep -q 'Status: install ok installed'" 2>/dev/null; then
missing="$missing $pkg"
fi
done
if [ -z "$missing" ]; then
echo " All packages already installed."
continue
fi
echo " Installing:$missing"
ssh "${SSH_OPTS[@]}" "root@$host" \
"DEBIAN_FRONTEND=noninteractive apt-get update -qq >/dev/null 2>&1 && \
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq$missing 2>&1 | tail -5"
echo " Done."
echo ""
done
# Enable sysstat data collection (sar) — off by default on Debian
for host in "${HOSTS[@]}"; do
echo "[$host] enabling sysstat/sar data collection..."
ssh "${SSH_OPTS[@]}" "root@$host" \
"sed -i 's/^ENABLED=\"false\"/ENABLED=\"true\"/' /etc/default/sysstat 2>/dev/null; \
systemctl enable --now sysstat 2>&1 | tail -2; \
grep ENABLED /etc/default/sysstat"
done