From fe15b8620d413fc2c89da0b48539a9474fae0308 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 3 Sep 2022 11:28:48 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 22271923..9a2c601d 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -15,23 +15,30 @@ shopt -s lastpipe #ssh root@10.5.10.35 '/vmfs/volumes/NFS_ESXi-Vault/esxi-shutdown.sh > /dev/null 2>&1' & > /dev/null 2>&1 -GETTEMP(){ +CHECKTEMP(){ mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc` - echo "$temp_c -> $temp_f" - else - echo "No temperature" + #echo "$temp_c -> $temp_f" + if [ $temp_f -ge ${TEMP_THRESHOLDS[${1}]['warn']} ] && [ $temp_f -lt ${TEMP_THRESHOLDS[${1}]['crit']} ]; then + echo "WARNING: $temp_f" + elif [ $temp_f -ge ${TEMP_THRESHOLDS[${1}]['crit']} ]; then + echo "CRITICAL: $temp_f" + else + echo "normal: $temp_f" + fi fi } + + if [ ${action-x} ]; then case $action in - gettemp) GETTEMP ${2};; + checktemp) CHECKTEMP ${2};; esac fi