chore: initial import from KNEL/PFVCluster@041d311 [#769]

Split per O&M lane work order. Full history: KNEL/PFVCluster.
https://projects.knownelement.com/issues/769#note-4152
This commit is contained in:
2026-09-03 21:39:22 -05:00
commit 51a1c9deee
41 changed files with 3428 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
# drac-extend: expose iDRAC IPMI temperature SDRs via snmpd extend [#625]
#
# Deployed to /usr/local/bin/drac-extend on pfv-tsys6 / pfv-tsys7.
# Creds live in /etc/snmp/drac-env (0600 root): DRAC_HOST, IPMI_USER, IPMI_PASS.
# Output: "<label> <celsius>" per enabled sensor, e.g. "inlet_temp 22".
# Consumed by Home Assistant SNMP sensors via value_template regex.
#
# Why extend and not the DRAC's own SNMP agent: iDRAC6/7 hardware MIB tables
# are unpopulated on this firmware generation (verified 2026-09-02), while
# IPMI SDR works. [#625]
set -euo pipefail
ENV_FILE="${DRAC_ENV:-/etc/snmp/drac-env}"
if [ ! -r "$ENV_FILE" ]; then
echo "drac-extend: missing $ENV_FILE" >&2
exit 1
fi
# shellcheck disable=SC1090 # env file is host-local by design (creds)
. "$ENV_FILE"
: "${DRAC_HOST:?DRAC_HOST unset}" "${IPMI_USER:?IPMI_USER unset}" "${IPMI_PASS:?IPMI_PASS unset}"
export IPMI_PASSWORD="${IPMI_PASS}"
ipmitool -I lanplus -E -H "$DRAC_HOST" -U "$IPMI_USER" \
sdr type temperature 2>/dev/null |
awk -F'|' '
$3 ~ /ok/ && $5 ~ /degrees C/ {
label = tolower($1)
gsub(/[^a-z0-9]+/, "_", label)
gsub(/^_+|_+$/, "", label)
value = $5
gsub(/[^0-9]/, "", value)
print label, value
}'