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