aten_pdu: Try to get full hosntname for mqtt pub

This commit is contained in:
Timo Makinen 2025-04-19 20:05:48 +00:00
parent 20c91fad84
commit 190a377076

View file

@ -51,6 +51,23 @@ do
continue
;;
esac
if device_name="$(ldapsearch -Q -LLL cn="${device}.*" cn | awk "
{
if (\$1 == \"cn:\") {
if (name) {
exit 1
}
name=\$2
}
} END {
if (!name) {
exit 1
}
print name
}
")" ; then
device="$device_name"
fi
for key in Current Power Voltage ; do
topic="home/${location}/${device}/$(echo "$key" | tr '[:upper:]' '[:lower:]')"
value="$(snmp_get "$name" "ATEN-PE-CFG::outlet${key}.${port}")"