#!/usr/bin/bash # powerman/identify-outlets.sh — flash each PDU outlet sequentially for physical tracing # # Run this from the workstation. It flashes each outlet one at a time so you # can walk the rack and see which device's LED blinks. Write down the mapping, # then run rename-outlets.sh with that mapping. # # Usage: # bash dcinfra/powerman/identify-outlets.sh # # On Friday: run this, walk the rack, note which outlet → which device. set -uo pipefail PROX_HOST="${PROX_HOST:-pfv-tsys1}" REMOTE_SH="$(cd "$(dirname "$0")/../.." && pwd)/tests/remote.sh" echo "PDU Outlet Identification — Flash Sequence" echo "============================================" echo "Each outlet will flash for 5 seconds. Walk the rack and note the device." echo "Press Enter to start..." read -r for i in $(seq 1 10); do echo "--- Outlet $i: FLASHING (5s) ---" PROX_HOST="$PROX_HOST" bash "$REMOTE_SH" prox "powerman -f outlet-$i" /dev/null sleep 5 PROX_HOST="$PROX_HOST" bash "$REMOTE_SH" prox "powerman -u outlet-$i" /dev/null echo " Outlet $i → ? (write it down)" echo "" [ "$i" -lt 10 ] && { echo "Press Enter for next outlet..."; read -r; } done echo "============================================" echo "Done. Now create your mapping file and run:" echo " bash dcinfra/powerman/rename-outlets.sh" echo "" echo "Format: outlet-number:new-name (one per line)" echo "Example:" echo " 1:pfv-tsys1" echo " 2:pfv-tsys3" echo " ..." echo "============================================"