From 156b40e0da39aa5e2c6086dd869256699a1268d8 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 30 Jan 2024 14:57:26 -0600 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index ff0d9d7d..dac1d2b3 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -103,7 +103,7 @@ CHECKTEMP(){ else echo -e "${idsCL[Default]}" fi - if [ "${temptype}" != "fans" ]; then + # if [ "${temptype}" != "fans" ]; then DIVIDER . lightCyan 70 echo -en "${idsCL[Yellow]}Pulling data for '${SENSOR}' ... " @@ -117,21 +117,23 @@ CHECKTEMP(){ if [ ${#vHOST_TEMPNAMES[@]} -gt 1 ]; then t=1 for sensorname in "${vHOST_TEMPNAMES[@]}"; do - temp_c=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.${t} -O vq | sed -e 's/"//g') - temp_c=`echo "scale=1; ${temp_c}/10" | bc` - temp_warn=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.11.1.${t} -O vq | sed -e 's/"//g') - temp_warn=`echo "scale=1; ${temp_warn}/10" | bc` - temp_crit=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.10.1.${t} -O vq | sed -e 's/"//g') - temp_crit=`echo "scale=1; ${temp_crit}/10" | bc` + if [ "${temptype}" != "fans" ] || ([ "${temptype}" == "fans" ] && [[ "${sensorname}" = *"Exhaust"* ]]); then + temp_c=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.${t} -O vq | sed -e 's/"//g') + temp_c=`echo "scale=1; ${temp_c}/10" | bc` + temp_warn=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.11.1.${t} -O vq | sed -e 's/"//g') + temp_warn=`echo "scale=1; ${temp_warn}/10" | bc` + temp_crit=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.10.1.${t} -O vq | sed -e 's/"//g') + temp_crit=`echo "scale=1; ${temp_crit}/10" | bc` - c=0; spc=''; spc1=`expr ${cw} - ${#sensorname} - 1`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done + c=0; spc=''; spc1=`expr ${cw} - ${#sensorname} - 1`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done - [ "${avgdays}" != "noavg" ] && echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Calculating ${avgdays_disp} average ... " - reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit} ${sensorname// /_} ${avgdays}) - [ "${avgdays}" != "noavg" ] && echo -en "\r\033[K" - echo -e "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}" + [ "${avgdays}" != "noavg" ] && echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Calculating ${avgdays_disp} average ... " + reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit} ${sensorname// /_} ${avgdays}) + [ "${avgdays}" != "noavg" ] && echo -en "\r\033[K" + echo -e "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}" - ((t++)) + ((t++)) + fi done else echo -e "${idsCL[LightCyan]} ${vHOSTNAME}${spc}${idsCL[Default]}: No Data" @@ -146,7 +148,7 @@ CHECKTEMP(){ # touch ${PW_TMPFOLDER}/${EHOST}.down # fi fi - fi + # fi echo fi