Update temp.inc.sh
This commit is contained in:
@@ -453,6 +453,8 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
|
|||||||
wait=$(echo "scale=0; ${PW_MYSQL_LOG_INTERVAL_NORMAL}*60" | bc)
|
wait=$(echo "scale=0; ${PW_MYSQL_LOG_INTERVAL_NORMAL}*60" | bc)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ] && temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32")
|
||||||
|
|
||||||
if [ "${PW_SENSOR_ID[${SENSORa}]}" != "" ] && [ ${lastinsert} -ge ${wait} ]; then
|
if [ "${PW_SENSOR_ID[${SENSORa}]}" != "" ] && [ ${lastinsert} -ge ${wait} ]; then
|
||||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||||
entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${vSENSOR// /_}' AND sensorid='${PW_SENSOR_ID[${SENSORa}]}'"))
|
entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${vSENSOR// /_}' AND sensorid='${PW_SENSOR_ID[${SENSORa}]}'"))
|
||||||
@@ -473,7 +475,6 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
|
|||||||
fi
|
fi
|
||||||
${mysql_conn} -e "${QRY}"
|
${mysql_conn} -e "${QRY}"
|
||||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
||||||
temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32")
|
|
||||||
${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')"
|
${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')"
|
||||||
fi
|
fi
|
||||||
touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
||||||
@@ -481,6 +482,10 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
|
|||||||
|
|
||||||
#### LOGGING OF SERVERROOM SENSOR DIFFERENCE
|
#### LOGGING OF SERVERROOM SENSOR DIFFERENCE
|
||||||
if [ "${SENSOR}" == "ServerRoomLA" ]; then
|
if [ "${SENSOR}" == "ServerRoomLA" ]; then
|
||||||
|
echo "SET SR-LA: ${temp_probe_f}"
|
||||||
|
temp_difference=$(bc <<< "scale=1; ${temp_probe_f}-${ServerRoomTH}")
|
||||||
|
(( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=1; ${temp_difference} * -1" | bc`
|
||||||
|
echo "DIFFERENCE: ${temp_difference}"
|
||||||
if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then
|
if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then
|
||||||
if [ "${temp_probe_f}" != "" ] && [ "${ServerRoomTH}" != "" ]; then
|
if [ "${temp_probe_f}" != "" ] && [ "${ServerRoomTH}" != "" ]; then
|
||||||
[ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference
|
[ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference
|
||||||
@@ -491,6 +496,7 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
|
|||||||
fi
|
fi
|
||||||
elif [ "${SENSOR}" == "ServerRoomTH" ]; then
|
elif [ "${SENSOR}" == "ServerRoomTH" ]; then
|
||||||
ServerRoomTH=${temp_f}
|
ServerRoomTH=${temp_f}
|
||||||
|
echo "SET SR-TH: ${ServerRoomTH}"
|
||||||
fi
|
fi
|
||||||
###################
|
###################
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user