Erster Upload

This commit is contained in:
root
2022-10-01 13:44:23 +02:00
commit 78aa2960d7
2 changed files with 93 additions and 0 deletions

42
check_zigbee_avail.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
# Return Codes:
# 0 - Ok! - Up
# 1 - Warning - Flaky
# 2 - Critical - Down
# 3 - Unknown - Ummm... What happened?!
print_usage() {
echo "Usage: check_zigbee.sh [Device-ID]"
echo "Example: check_zigbee.sh 84ba20fffe77b851"
}
function beenden {
exit $1
}
#Parameter prüfen
if [ $# -ne 1 ]; then
print_usage
beenden 3
fi
ZigBeeDeviceID=$1
ZigBeeDeviceAvail=$(curl -S -m 5 http://172.30.80.246:8087/getPlainValue/zigbee.0.${ZigBeeDeviceID}.available 2>/dev/null)
if [ $? -ne 0 ] ; then
echo "ioBroker-API not available or wrong Zigbee-ID."
beenden 3
fi
if [ "$ZigBeeDeviceAvail" == "true" ] ; then
ZigBeeDeviceLink=$(curl -S -m 5 http://172.30.80.246:8087/getPlainValue/zigbee.0.${ZigBeeDeviceID}.link_quality 2>/dev/null)
echo "OK: Zigbee-Device ${ZigBeeDeviceID} ist connected | link_qualitiy=${ZigBeeDeviceLink}"
beenden 0
else
echo "Error: Zigbee-Device ${ZigBeeDeviceID} not connected"
beenden 2
fi
beenden 3