From 17c2b560cc3583061a681f214dd7d7c767bbe314 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Fri, 16 May 2025 17:07:08 +0000 Subject: [PATCH] aten_pdu: Also log pdu info itself --- roles/aten_pdu/files/aten-mqtt-publish.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/aten_pdu/files/aten-mqtt-publish.sh b/roles/aten_pdu/files/aten-mqtt-publish.sh index 60803fa..971def7 100755 --- a/roles/aten_pdu/files/aten-mqtt-publish.sh +++ b/roles/aten_pdu/files/aten-mqtt-publish.sh @@ -52,6 +52,16 @@ ldapsearch -Q -LLL "(&(objectClass=device)(description=Aten PE*))" cn l | awk ' } ' | while read -r name location do + for key in Current Voltage Power ; do + topic="home/${location}/${name}/$(echo "$key" | tr '[:upper:]' '[:lower:]')" + value="$(snmp_get "$name" "ATEN-PE-CFG:device${key}.1")" + if $_noop ; then + echo "${topic} -> ${value}" + else + mqtt_send "$topic" "$value" + fi + done + snmpwalk -v 1 -c "$community" "$name" -Oq \ -m ATEN-PE-CFG ATEN-PE-CFG::outletName | while read -r port device do