Update powerwall.sh
This commit is contained in:
@@ -17,7 +17,7 @@ VERBOSE=false
|
|||||||
|
|
||||||
CHECKTEMP(){
|
CHECKTEMP(){
|
||||||
start=`date +%s`
|
start=`date +%s`
|
||||||
cw=45;
|
cw=25;
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-a|-avg) avgdays=${2};;
|
-a|-avg) avgdays=${2};;
|
||||||
@@ -109,6 +109,7 @@ CHECKTEMP(){
|
|||||||
CHECKTEMPSENSOR(){
|
CHECKTEMPSENSOR(){
|
||||||
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
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 ${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
|
if [ "${6}" != "noavg" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]; then
|
||||||
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
|
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
|
||||||
if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then
|
if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then
|
||||||
@@ -144,6 +145,7 @@ CHECKTEMPSENSOR(){
|
|||||||
if [ "${1}" == "Powerwall-CPU-Usage" ]; then
|
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')
|
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
|
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")
|
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} "/opt/idssys/defaults/get-data.sh cpu-usage")
|
||||||
fi
|
fi
|
||||||
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
||||||
|
|||||||
Reference in New Issue
Block a user