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