aten_pdu: Try to get full hosntname for mqtt pub
This commit is contained in:
parent
20c91fad84
commit
190a377076
1 changed files with 18 additions and 1 deletions
|
@ -51,6 +51,23 @@ do
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
for key in Current Power Voltage ; do
|
||||||
topic="home/${location}/${device}/$(echo "$key" | tr '[:upper:]' '[:lower:]')"
|
topic="home/${location}/${device}/$(echo "$key" | tr '[:upper:]' '[:lower:]')"
|
||||||
value="$(snmp_get "$name" "ATEN-PE-CFG::outlet${key}.${port}")"
|
value="$(snmp_get "$name" "ATEN-PE-CFG::outlet${key}.${port}")"
|
||||||
|
|
Loading…
Add table
Reference in a new issue