layered-soul/skills/systematic-debugging/scripts/network-lag-baseline.sh
Hermes & Sam 5c5df32101 Populate layered-soul: identity, memories, skills, plan (Hermes & Sam)
- SOUL.md: full agent identity, operating principles, voice
- IDENTITY.md: runtime identity, hosts, boundaries
- USER.md: operator context imported from hermes-soul
- AGENTS.md: actual operating rules, infrastructure, quick reference
- memories/curated/: 5 topics (tailscale, forgejo, agents, projects, vaultwarden)
- skills/: 9 cross-harness skills imported from hermes-soul after review
- docs/PLAN-CONFIGURE-PRIVATE-REPO.md: configuration plan
- Validate: passes clean
2026-06-14 00:21:26 +02:00

69 lines
2 KiB
Bash

#!/usr/bin/env bash
# Generic SSH/tmux/Wi-Fi lag baseline collector.
# Usage: WIFI_IFACE=wlp1s0 ROUTER_IP=192.168.1.1 REMOTE_IP=1.2.3.4 ./network-lag-baseline.sh [output-file]
set -euo pipefail
STAMP=$(date +%Y%m%d-%H%M%S)
OUT="${1:-./network-lag-$STAMP.txt}"
IFACE="${WIFI_IFACE:-}"
ROUTER="${ROUTER_IP:-}"
PUBLIC="${PUBLIC_IP:-1.1.1.1}"
REMOTE="${REMOTE_IP:-}"
if [[ -z "$IFACE" ]]; then
IFACE=$(iw dev 2>/dev/null | awk '/Interface/ {print $2; exit}' || true)
fi
if [[ -z "$ROUTER" ]]; then
ROUTER=$(ip route show default 2>/dev/null | awk '{print $3; exit}' || true)
fi
{
echo "network lag baseline - $STAMP"
echo "host: $(hostname)"
echo
echo "## system"
date '+%Y-%m-%d %A %H:%M:%S %Z'
uname -a
uptime
echo
echo "## interface"
if [[ -n "$IFACE" ]]; then
ip -details link show "$IFACE" || true
ip -s link show "$IFACE" || true
nmcli -f GENERAL,WIFI-PROPERTIES,IP4 device show "$IFACE" 2>/dev/null | sed -n '1,140p' || true
iw dev "$IFACE" link 2>/dev/null || true
nmcli -f ACTIVE,SSID,BSSID,CHAN,RATE,SIGNAL,BARS,SECURITY dev wifi list --rescan yes 2>/dev/null | sed -n '1,100p' || true
else
echo "No Wi-Fi interface auto-detected; set WIFI_IFACE."
fi
echo
echo "## ssh sockets"
ss -nti '( sport = :22 or dport = :22 )' 2>/dev/null || true
echo
echo "## overlay VPN state"
tailscale status 2>&1 | sed -n '1,100p' || true
tailscale netcheck 2>&1 | sed -n '1,120p' || true
echo
echo "## ping summaries"
for target in "$ROUTER" "$PUBLIC" "$REMOTE"; do
[[ -n "$target" ]] || continue
echo "--- ping $target"
ping -c 50 -i 0.1 "$target" 2>&1 | tail -6 || true
done
echo
echo "## TCP counters"
awk '/^Tcp:/{if(++n==1){h=$0}else{print h; print $0}}' /proc/net/snmp || true
echo
echo "## recent network logs"
journalctl --since '15 minutes ago' --no-pager 2>/dev/null \
| egrep -i 'wlan|wlp|iwlwifi|ath[0-9k]*|brcm|rtw|tailscale|dns|disconnect|deauth|timeout|error|warn|UFW BLOCK' \
| tail -180 || true
} | tee "$OUT"
echo "Saved report: $OUT"