From dec59ee7e899c1919ec39590ee32d62fd71653f7 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 3 Dec 2023 17:09:38 -0600 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/powerwall.sh b/powerwall.sh index b884fec8..1953b575 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -17,7 +17,7 @@ VERBOSE=false CHECKTEMP(){ start=`date +%s` - cw=45; + cw=25; while [ $# -gt 0 ]; do case "$1" in -a|-avg) avgdays=${2};; @@ -109,6 +109,7 @@ CHECKTEMP(){ CHECKTEMPSENSOR(){ echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit + echo "${temp_warn} - ${temp_crit}" if [ "${6}" != "noavg" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]; then [ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3 if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then @@ -144,6 +145,7 @@ CHECKTEMPSENSOR(){ if [ "${1}" == "Powerwall-CPU-Usage" ]; then temp_c=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat) | sed -e 's/%//g') else + echo "WOW" temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} "/opt/idssys/defaults/get-data.sh cpu-usage") fi echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn