Update temp.inc.sh

This commit is contained in:
2024-05-23 21:14:33 -05:00
parent dd21213640
commit 47276b6aa1

View File

@@ -557,6 +557,7 @@ CHECKTEMP(){
fi fi
if [ "${TTYPE}" == "fans" ]; then if [ "${TTYPE}" == "fans" ]; then
if [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"${PW_HOST_IDRACS[${SENSOR}]}"* ]]; then
if [ -f ${PW_TMPFOLDER}/.lastfancheck/${cSENSOR}.gl ]; then if [ -f ${PW_TMPFOLDER}/.lastfancheck/${cSENSOR}.gl ]; then
FSC="${idsCL[LightGreen]}" FSC="${idsCL[LightGreen]}"
elif [ -f ${PW_TMPFOLDER}/.lastfancheck/${cSENSOR}.set ]; then elif [ -f ${PW_TMPFOLDER}/.lastfancheck/${cSENSOR}.set ]; then
@@ -581,6 +582,10 @@ CHECKTEMP(){
else else
echo -e "${idsCL[Default]}" echo -e "${idsCL[Default]}"
fi fi
else
echo -e " Fans are not managed for this host"
fi
fi fi
fi fi
((t++)) ((t++))
@@ -849,7 +854,8 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
t=1 t=1
####### Grab Fan Speeds ####### ####### Grab Fan Speeds #######
if [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ] && ([ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa} ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa})) -ge 60 ]); then # if [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ] && ([ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa} ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa})) -ge 60 ]); then
if [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ]; then
# vHOSTFAN=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${SENSORa}]} .1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.3 -O vq) # vHOSTFAN=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${SENSORa}]} .1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.3 -O vq)
vHOSTFAN=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_RACADM_ACCESS} racadm -r ${PW_HOST_IDRACS[${SENSORa}]} -u ${PW_ESXI_USER} -p "'${PW_ESXI_PASS}'" getsensorinfo | grep "System Board Fan3" 2>&1) vHOSTFAN=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_RACADM_ACCESS} racadm -r ${PW_HOST_IDRACS[${SENSORa}]} -u ${PW_ESXI_USER} -p "'${PW_ESXI_PASS}'" getsensorinfo | grep "System Board Fan3" 2>&1)
if [ "${vHOSTFAN}" != "" ]; then if [ "${vHOSTFAN}" != "" ]; then
@@ -1006,12 +1012,13 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
##### ESXI FAN CONTROL ##### ##### ESXI FAN CONTROL #####
elif [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"${PW_HOST_IDRACS[${SENSORa}]}"* ]] && [[ "${vSENSOR}" = *"Exhaust"* ]] && [ "${FanSpeed}" != "" ]; then elif [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"${PW_HOST_IDRACS[${SENSORa}]}"* ]] && [[ "${vSENSOR}" = *"Exhaust"* ]] && [ "${FanSpeed}" != "" ]; then
if [ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.chkset ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.chkset)) -ge 300 ]; then
if [ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ]; then if [ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ]; then
NEW_FanSpeed=$(GET_DEFAULT_FANSPEED ${SENSORa} ${FanSpeed}) NEW_FanSpeed=$(GET_DEFAULT_FANSPEED ${SENSORa} ${FanSpeed})
SENDNOTICE "${PW_HOST_IDRACS[${SENSORa}]} FanSpeed Control" "Re-enabling Host Fan control to Powerwall. Setting fans back to defaults: ${NEW_FanSpeed}%" SENDNOTICE "${PW_HOST_IDRACS[${SENSORa}]} FanSpeed Control" "Re-enabling Host Fan control to Powerwall. Setting fans back to defaults: ${NEW_FanSpeed}%"
ipmitool -I lanplus -H ${PW_HOST_IDRACS[${SENSORa}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x00 >/dev/null 2>&1 ipmitool -I lanplus -H ${PW_HOST_IDRACS[${SENSORa}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x00 >/dev/null 2>&1
[ "${SENSORa}" == "iDS-vMS-Host7" ] && ipmitool -I lanplus -H 10.10.2.26 -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x00 >/dev/null 2>&1 [ "${SENSORa}" == "iDS-vMS-Host7" ] && [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"10.10.2.26"* ]] && ipmitool -I lanplus -H 10.10.2.26 -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x00 >/dev/null 2>&1
SET_ESXI_FANSPEED ${NEW_FanSpeed} ${SENSORa} e >/dev/null 2>&1 & SET_ESXI_FANSPEED ${NEW_FanSpeed} ${SENSORa} e >/dev/null 2>&1 &
fi fi
@@ -1020,7 +1027,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
if [ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.gl ] && [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set)) -ge 3600 ]; then if [ ! -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.gl ] && [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set)) -ge 3600 ]; then
# SENDNOTICE "${PW_HOST_IDRACS[${SENSORa}]} FAN CONTROL" "Goldilock Zone Found at ${FanSpeed}%" # SENDNOTICE "${PW_HOST_IDRACS[${SENSORa}]} FAN CONTROL" "Goldilock Zone Found at ${FanSpeed}%"
echo "${FanSpeed}" >| ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.gl echo "${FanSpeed}" >| ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.gl
[ "${SENSORa}" == "iDS-vMS-Host7" ] && [ ! -f ${PW_TMPFOLDER}/iDS-vMS-Host6.down ] && echo "${FanSpeed}" >| ${PW_TMPFOLDER}/.lastfancheck/iDS-vMS-Host6.gl [ "${SENSORa}" == "iDS-vMS-Host7" ] && [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"10.10.2.26"* ]] && [ ! -f ${PW_TMPFOLDER}/iDS-vMS-Host6.down ] && echo "${FanSpeed}" >| ${PW_TMPFOLDER}/.lastfancheck/iDS-vMS-Host6.gl
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${FanSpeed}% - ${SENSORa} - Goldilock Zone Found (1HR)" >> ${logtemp} echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${FanSpeed}% - ${SENSORa} - Goldilock Zone Found (1HR)" >> ${logtemp}
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${FanSpeed}% - ${SENSORa} - Goldilock Zone Found (1HR)" >> ${PW_LOGFOLDER}/esxi-fanspeeds.log echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${FanSpeed}% - ${SENSORa} - Goldilock Zone Found (1HR)" >> ${PW_LOGFOLDER}/esxi-fanspeeds.log
@@ -1071,12 +1078,15 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi fi
fi fi
fi fi
touch ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.chkset
fi
elif [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" != *"${PW_HOST_IDRACS[${SENSORa}]}"* ]] && [[ "${vSENSOR}" = *"Exhaust"* ]]; then elif [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" != *"${PW_HOST_IDRACS[${SENSORa}]}"* ]] && [[ "${vSENSOR}" = *"Exhaust"* ]]; then
if [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ]; then if [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ]; then
SENDNOTICE "${PW_HOST_IDRACS[${SENSORa}]} FanSpeed Control" "Resetting Fans back to being Host Controlled" SENDNOTICE "${PW_HOST_IDRACS[${SENSORa}]} FanSpeed Control" "Resetting Fans back to being Host Controlled"
rm -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}* rm -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}*
ipmitool -I lanplus -H ${PW_HOST_IDRACS[${SENSORa}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x01 >/dev/null 2>&1 ipmitool -I lanplus -H ${PW_HOST_IDRACS[${SENSORa}]} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x01 >/dev/null 2>&1
if [ "${SENSORa}" == "iDS-vMS-Host7" ]; then if [ "${SENSORa}" == "iDS-vMS-Host7" ] && [[ "${PW_ESXI_FANSPEEDCONTROL_HOSTS}" = *"10.10.2.26"* ]]; then
SENDNOTICE "10.10.2.26 FanSpeed Control" "Resetting Fans back to being Host Controlled" SENDNOTICE "10.10.2.26 FanSpeed Control" "Resetting Fans back to being Host Controlled"
rm -f ${PW_TMPFOLDER}/.lastfancheck/iDS-vMS-Host6* rm -f ${PW_TMPFOLDER}/.lastfancheck/iDS-vMS-Host6*
ipmitool -I lanplus -H 10.10.2.26 -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x01 >/dev/null 2>&1 ipmitool -I lanplus -H 10.10.2.26 -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" raw 0x30 0x30 0x01 0x01 >/dev/null 2>&1
@@ -1088,6 +1098,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi fi
fi fi
if [[ "${SENSORa}" != *"-Usage"* ]] && [[ "${SENSORa}" != *"FAN"* ]] && (( $(bc <<< "${temp_f} < ${temp_warn}") )); then if [[ "${SENSORa}" != *"-Usage"* ]] && [[ "${SENSORa}" != *"FAN"* ]] && (( $(bc <<< "${temp_f} < ${temp_warn}") )); then
if (( $(bc <<< "${last_temp} >= ${temp_warn}") )); then if (( $(bc <<< "${last_temp} >= ${temp_warn}") )); then
[ -f ${PW_TMPFOLDER}/${SENSORa}.down ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}.down)) -ge 1800 ] && SENDNOTICE "${SENSOR} BACK TO NORMAL" "NORMAL TEMP: ${temp_f}${GAUGESH} [ -f ${PW_TMPFOLDER}/${SENSORa}.down ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}.down)) -ge 1800 ] && SENDNOTICE "${SENSOR} BACK TO NORMAL" "NORMAL TEMP: ${temp_f}${GAUGESH}