Update powerwall.sh
This commit is contained in:
26
powerwall.sh
26
powerwall.sh
@@ -245,7 +245,7 @@ CHECKTEMP_SERVICE(){
|
||||
fi
|
||||
if [ "${SENSORS_CHECK}" != "" ]; then
|
||||
for SENSOR in "${SENSORS_CHECK[@]}"; do
|
||||
[ "${last_temp[${SENSOR}]}" == "" ] && last_temp[${SENSOR}]=0
|
||||
[ "${last_temp[${SENSOR//-/}]}" == "" ] && last_temp[${SENSOR//-/}]=0
|
||||
if [ "${PW_THRESHOLDS[${SENSORa}]}" != "" ]; then
|
||||
echo ${PW_THRESHOLDS[${SENSORa}]} | cut -d',' -f 1 | read temp_warn
|
||||
echo ${PW_THRESHOLDS[${SENSORa}]} | cut -d',' -f 2 | read temp_crit
|
||||
@@ -305,7 +305,7 @@ CHECKTEMP_SERVICE(){
|
||||
|
||||
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "cpu" ] && temp_f=$(echo "scale=2; $temp_c/1" | bc -l) || temp_f=$(echo "scale=2; ${temp_c}*1.8 + 32" | bc)
|
||||
[ "${SENSOR}" == "ServerRoomTH" ] && temp_f=`echo "scale=2; ${temp_f}+${PW_ServerRoomTH_Dev}" | bc`
|
||||
echo "HERE: [${SENSOR}] - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
|
||||
echo "HERE: [${SENSOR//-/}] - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
|
||||
# [ ! "${temp_c}" ] || [ ! "${temp_f}" ] || [ ! "${temp_warn}" ] || [ ! "${temp_crit}" ] || [ ! "${temp_crit_sys}" ] && echo "VALUE NOT FOUND"
|
||||
|
||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then
|
||||
@@ -316,15 +316,15 @@ CHECKTEMP_SERVICE(){
|
||||
|
||||
echo 1
|
||||
if (( $(bc <<< "${temp_f} < ${temp_warn}") )); then
|
||||
echo "2 - ${last_temp[${SENSOR}]}"
|
||||
if (( $(bc <<< "${last_temp[${SENSOR}]} > 1") )); then
|
||||
echo "2 - ${last_temp[${SENSOR//-/}]}"
|
||||
if (( $(bc <<< "${last_temp[${SENSOR//-/}]} > 1") )); then
|
||||
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}
|
||||
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}
|
||||
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - Back to NORMAL ${GAUGE}" >> ${PW_LOGFILE}
|
||||
# [ "$(compgen -G "${PW_TMPFOLDER}/power.*.off")" != "" ] && rm -f ${PW_TMPFOLDER}/power.*.off
|
||||
|
||||
elif [ "${last_temp[${SENSOR}]}" == "0" ]; then
|
||||
elif [ "${last_temp[${SENSOR//-/}]}" == "0" ]; then
|
||||
echo 4
|
||||
# SENDNOTICE "${SENSOR} TEMP NORMAL" "Service Startup
|
||||
# NORMAL TEMP: ${temp_f}${GAUGESH}"
|
||||
@@ -338,7 +338,7 @@ Previous Temp: ${last_temp[${SENSOR}]}${GAUGESH}"
|
||||
fi
|
||||
rm -f ${PW_TMPFOLDER}/temp.*
|
||||
rm -f ${PW_TMPFOLDER}/power.${SENSORa}.off
|
||||
last_temp[${SENSOR}]=1
|
||||
last_temp[${SENSOR//-/}]=1
|
||||
|
||||
# iDS-vMS-Offsite Fan Issue Workaround
|
||||
if [ "${PW_HOST_IDRACS[${SENSORa}]}" == "10.2.1.21" ]; then
|
||||
@@ -357,15 +357,15 @@ Previous Temp: ${last_temp[${SENSOR}]}${GAUGESH}"
|
||||
fi
|
||||
|
||||
else
|
||||
([ ! "${last_temp[${SENSOR}]}" ] || (( $(bc <<< "${last_temp[${SENSOR}]} < 2") ))) && last_temp[${SENSOR}]=${temp_f}
|
||||
temp_diff=`echo "scale=2; ${last_temp[${SENSOR}]}-${temp_f}" | bc`
|
||||
([ ! "${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
|
||||
touch ${PW_TMPFOLDER}/temp.warn
|
||||
if (( $(bc <<< "${temp_diff} > 1") )) || (( $(bc <<< "${temp_diff} = 1") )); then
|
||||
SENDNOTICE "${SENSOR} ${GAUGE} WARNING" "WARNING ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}')" 1
|
||||
last_temp[${SENSOR}]=${temp_f}
|
||||
last_temp[${SENSOR//-/}]=${temp_f}
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - WARNING ${GAUGE} - (Difference of ${temp_diff}')" >> ${logtemp}
|
||||
|
||||
# iDS-vMS-Offsite Fan Issue Workaround
|
||||
@@ -381,7 +381,7 @@ Previous Temp: ${last_temp[${SENSOR}]}${GAUGESH}"
|
||||
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}
|
||||
last_temp[${SENSOR}]=${temp_f}
|
||||
last_temp[${SENSOR//-/}]=${temp_f}
|
||||
|
||||
if [ "${SENSOR}" == "ServerRoomTH" ] && [ ! -f touch ${PW_TMPFOLDER}/temp.crit ]; then
|
||||
touch ${PW_TMPFOLDER}/temp.crit
|
||||
@@ -400,7 +400,7 @@ Previous Temp: ${last_temp[${SENSOR}]}${GAUGESH}"
|
||||
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}
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - CRITICAL ${GAUGE} SYSTEM - (Difference of ${temp_diff}')" >> ${PW_LOGFILE}
|
||||
last_temp[${SENSOR}]=${temp_f}
|
||||
last_temp[${SENSOR//-/}]=${temp_f}
|
||||
if [ ! -f touch ${PW_TMPFOLDER}/temp.critsys ]; then
|
||||
touch ${PW_TMPFOLDER}/temp.critsys
|
||||
[ "${SENSOR}" == "ServerRoomTH" ] && SHUTDOWN_SYS ${SENSOR} TEMP &
|
||||
|
||||
Reference in New Issue
Block a user