This commit is contained in:
2023-12-26 20:46:55 -06:00
parent 9765f27b2d
commit f2f7705d48
3 changed files with 10 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
VERS='2.5.70-12262023'
VERS='2.5.71-12262023'
noheader=' update service dailytemp confsync '

View File

@@ -57,8 +57,8 @@ CHECKPOWER(){
[ "${TEST_BATTVOLT}" != "" ] && BATTV=${TEST_BATTVOLT} || BATTV=`echo ${INVSTATSINFO} | jq '.inputs .battV'`
BATTA=`echo ${INVSTATSINFO} | jq '.inputs .xfA'`
BATTLIFE=`echo "scale=2; (${BATTV}*100)/${BATT_FULL}" | bc`
if (( $(bc <<<"${BATTV} > ${FLOAT_CHARGE}") )); then
if (( $(bc <<<"${BATTV} > ${BULK_CHARGE}") )); then
if (( $(bc <<<"${BATTV} >= ${FLOAT_CHARGE}") )); then
if (( $(bc <<<"${BATTV} >= ${BULK_CHARGE}") )); then
BATTA_disp="${idsCL[Green]}`IDS_NUMBER_FORMAT ${BATTA}`'amps ${idsCL[LightCyan]}- Bulk Charging"
else
BATTA_disp="${idsCL[Green]}`IDS_NUMBER_FORMAT ${BATTA}`'amps ${idsCL[LightCyan]}- Float Charging"
@@ -472,7 +472,7 @@ Shutting down main servers" 1
if [ -f ${PW_TMPFOLDER}/power.ac.low ] || [ -f ${PW_TMPFOLDER}/power.dc.low ]; then
volt_diff=`echo "scale=1; ${last_battvolt}-${BATTVOLT}" | bc`
(( $(bc <<<"${volt_diff} < 0") )) && volt_diff=`echo "scale=2; ${volt_diff} * -1" | bc`
if (( $(bc <<<"${volt_diff} > 0.5") )); then
if (( $(bc <<<"${volt_diff} >= 0.5") )); then
SENDNOTICE "BATTERY VOLTAGE CHANGE" "Battery Voltage: ${BATTVOLT}'volts"
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${BATTVOLT}'volts - Battery Voltage Change" >> ${PW_LOGPOWER}
last_battvolt=${BATTVOLT}

View File

@@ -38,7 +38,7 @@ CHECKTEMP(){
read -rd '' -a vHOST_TEMPNAMES <<<"${vHOST_TEMPNAMES}"
unset IFS
echo -en "\r\033[K"
if [ ${#vHOST_TEMPNAMES[@]} > 1 ]; then
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')
@@ -470,9 +470,9 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
FanSpeed=''
fi
fi
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 2
if (( $(bc <<< "${temp_f} < ${temp_warn}") )); then
if (( $(bc <<< "${last_temp[${SENSOR//-/}]} > 1") )); then
if (( $(bc <<< "${last_temp[${SENSOR//-/}]} >= 1") )); 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}
Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Back to NORMAL ${GAUGE} - Previous ${GAUGE}: ${last_temp[${SENSOR//-/}]}${GAUGESH}" >> ${logtemp}
@@ -490,7 +490,6 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Normal ${GAUGE}" >> ${logtemp}
fi
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 2a
rm -f ${PW_TMPFOLDER}/temp.*
rm -f ${PW_TMPFOLDER}/power.${SENSORa}.*
@@ -509,17 +508,15 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi
else
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 2b
([ ! "${last_temp[${SENSOR//-/}]}" ] || (( $(bc <<< "${last_temp[${SENSOR//-/}]} < 2") ))) && last_temp[${SENSOR//-/}]=${temp_f}
temp_diff=`echo "scale=2; ${last_temp[${SENSOR//-/}]}-${temp_f}" | bc`
[ $(bc -l <<< "${temp_diff} < 0") -eq 1 ] && temp_diff=`echo "scale=2; ${temp_diff}*-1" | bc`
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 2b1
touch ${PW_TMPFOLDER}/temp.warn
if (( $(bc <<< "${temp_diff} > 1") )) || (( $(bc <<< "${temp_diff} = 1") )); then
if (( $(bc <<< "${temp_diff} >= 1") )); then
SENDNOTICE "${SENSOR} ${GAUGE} WARNING" "WARNING ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}')" 1
last_temp[${SENSOR//-/}]=${temp_f}
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - WARNING ${GAUGE} - (Difference of ${temp_diff}')" >> ${logtemp}
@@ -535,10 +532,8 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - Server Warm, setting FanSpeed to 80%" >> ${PW_LOGFILE}
fi
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit_sys}") -eq 1 ]; then
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 2b2
if (( $(bc <<< "${temp_diff} > 1") )) || (( $(bc <<< "${temp_diff} = 1") )); then
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit_sys}") -eq 1 ]; then
if (( $(bc <<< "${temp_diff} >= 1") )); then
SENDNOTICE "${SENSOR} ${GAUGE} CRITICAL" "CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}')" 1
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - CRITICAL - (Difference of ${temp_diff}${GAUGESH})" >> ${logtemp}
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} - ${temp_f}${GAUGESH} - CRITICAL ${GAUGE} - (Difference of ${temp_diff}')" >> ${PW_LOGFILE}
@@ -557,8 +552,6 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi
fi
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit_sys}") -eq 1 ]; then
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 2b3
if (( $(bc <<< "${temp_diff} >= 1") )); then
SENDNOTICE "${SENSOR} TEMP CRITICAL" "SYSTEM CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}')" 1
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - SYSTEM CRITICAL - (Difference of ${temp_diff})" >> ${logtemp}
@@ -572,7 +565,6 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi
fi
fi
[ "${SENSORa}" == "Powerwall-CPU-Usage" ] && echo 3
fi
[ -f ${PW_TMPFOLDER}/${SENSOR}.insert ] && lastinsert=$(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}.insert)) || lastinsert=100000