aten_pdu: Add noop mode to mqtt publish script
This commit is contained in:
parent
d4d68dc962
commit
20c91fad84
1 changed files with 11 additions and 1 deletions
|
@ -5,6 +5,12 @@ umask 077
|
|||
|
||||
community="public"
|
||||
|
||||
if [ "${1:-}" = "-n" ]; then
|
||||
_noop=true
|
||||
else
|
||||
_noop=false
|
||||
fi
|
||||
|
||||
mqtt_send() {
|
||||
topic="$1"
|
||||
value="$2"
|
||||
|
@ -48,7 +54,11 @@ do
|
|||
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}")"
|
||||
mqtt_send "$topic" "$value"
|
||||
if $_noop ; then
|
||||
echo "${topic} -> ${value}"
|
||||
else
|
||||
mqtt_send "$topic" "$value"
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue