Update powerwall.sh
This commit is contained in:
@@ -145,7 +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
|
||||
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} "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'")
|
||||
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} 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')
|
||||
fi
|
||||
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
||||
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
||||
@@ -184,7 +184,7 @@ CHECKTEMPSENSOR(){
|
||||
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||
if [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
|
||||
echo -e "${spc} [${spcw}${idsCL[Yellow]}${temp_warn}%${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}%=>${idsCL[Default]} ]"
|
||||
echo -e "${spc} [${spcw} ${idsCL[Yellow]}${temp_warn}%${idsCL[Default]} /${spcc} ${idsCL[Red]}${temp_crit}%=>${idsCL[Default]} ]"
|
||||
|
||||
else
|
||||
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}'F${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}'F=>${idsCL[Default]} ]"
|
||||
|
||||
Reference in New Issue
Block a user