Update temp.inc.sh
This commit is contained in:
@@ -662,29 +662,46 @@ SENDTEMP(){
|
|||||||
# fi
|
# fi
|
||||||
|
|
||||||
for SENSOR in "${SENSORS_CHECK[@]}"; do
|
for SENSOR in "${SENSORS_CHECK[@]}"; do
|
||||||
|
if [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then
|
||||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
|
mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
||||||
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`
|
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||||
temp_c=$(echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1)
|
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ]; then
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ]; then
|
||||||
temp_c=$(vcgencmd measure_temp)
|
INFO=$(curl -s --get -d "deviceid=${PW_LACROSSE_ID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
|
||||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
if [[ "${1}" = *"-Probe" ]]; then
|
||||||
|
temp_c=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].probe_temp') 2 yes`
|
||||||
|
else
|
||||||
|
temp_c=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp') 2 yes`
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ]; then
|
||||||
|
if [[ "${1}" = *"CPU"* ]]; then
|
||||||
|
temp_c=$(vcgencmd measure_temp)
|
||||||
|
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||||
|
elif [[ "${1}" = *"FAN"* ]]; then
|
||||||
|
temp_c=$(cat /sys/class/hwmon/hwmon2/fan1_input)
|
||||||
|
fi
|
||||||
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "remotesystem" ]; then
|
||||||
|
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} vcgencmd measure_temp)
|
||||||
|
if [ "${temp_c}" != "" ]; then
|
||||||
|
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "remotesystem" ]; then
|
fi
|
||||||
temp_c=$(ssh root@${PW_REMOTE_SENSORS[${SENSOR}]} vcgencmd measure_temp)
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "esxi" ]; then
|
||||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
temp_c=${2}
|
||||||
|
temp_warn=`echo $(bc <<< "scale=2; (${3}*1.8+32)/1") | awk '{print int($1+0.5)}'`
|
||||||
|
temp_crit=`echo $(bc <<< "scale=2; (${4}*1.8+32)/1") | awk '{print int($1+0.5)}'`
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
|
||||||
temp_c=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${SENSORa}]} .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.${t} -O vq | sed -e 's/"//g')
|
if [ "${1}" == "Powerwall-CPU-Usage" ]; then
|
||||||
temp_c=`echo "scale=1; ${temp_c}/10" | bc`
|
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')
|
||||||
vSENSOR=${SENSOR}
|
else
|
||||||
SENSOR="${SENSORa}-${vSENSOR// /_}"
|
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} "/opt/idssys/defaults/get-data.sh cpu-usage")
|
||||||
((t++))
|
fi
|
||||||
else
|
else
|
||||||
temp_c=''
|
temp_c=''
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${1}" != "" ]; then
|
if [ "${1}" != "" ]; then
|
||||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||||
average1=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 1 ${vSENSOR// /_})
|
average1=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 1 ${vSENSOR// /_})
|
||||||
@@ -704,6 +721,7 @@ SENDTEMP(){
|
|||||||
echo -e "${SENSOR}${spc}No Data"
|
echo -e "${SENSOR}${spc}No Data"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
[ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ] && echo
|
[ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ] && echo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user