Split per O&M lane work order. Full history: KNEL/PFVCluster. https://projects.knownelement.com/issues/769#note-4152
21 lines
785 B
Bash
21 lines
785 B
Bash
#!/bin/bash
|
|
# garage-pdu-relay: expose APC AP7830 metered output current via snmpd extend.
|
|
#
|
|
# Relay pattern (founder ruling 2026-09-02): the garage PDU speaks SNMPv1
|
|
# only, walks die on its old AOS, and its ACL admits the LibreNMS VM vantage.
|
|
# This relay runs ON tsys-librenms; HA polls the relay via the fleet snmpd
|
|
# extend (same rails as drac-extend). Output: "output_amps <x.y>".
|
|
set -euo pipefail
|
|
|
|
PDU_HOST="${PDU_HOST:-pfv-garage-pdu-1.knel.net}"
|
|
COMMUNITY="${PDU_COMMUNITY:-kn3lmgmt}"
|
|
OID=".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1"
|
|
|
|
raw=$(snmpget -v1 -c "$COMMUNITY" -On -Ov "$PDU_HOST" "$OID" 2>/dev/null \
|
|
| grep -oE '[0-9]+$') || true
|
|
if [ -z "${raw:-}" ]; then
|
|
echo "output_amps unavailable"
|
|
exit 0
|
|
fi
|
|
awk -v t="$raw" 'BEGIN { printf "output_amps %.1f\n", t/10 }'
|