Update temp.inc.sh
This commit is contained in:
@@ -864,6 +864,7 @@ CHECKTEMP_SERVICE(){
|
||||
}
|
||||
CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
SENSORa=${1}
|
||||
[ "${PW_DESC_TEMP[${SENSORa}]}" != "" ] && SENSOR_DESC=${PW_DESC_TEMP[${SENSORa}]} || SENSOR_DESC=${SENSORa}
|
||||
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
|
||||
touch ${PW_TMPFOLDER}/ztemprun.${SENSORa}.running
|
||||
|
||||
@@ -880,7 +881,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||
[[ "${PW_HOST_IDRACS[${SENSORa}]}" = "10.6."* ]] && ESXI_PASS=${PW_ESXI_PASS_KP} || ESXI_PASS=${PW_ESXI_PASS}
|
||||
if [ -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ]; then
|
||||
SENDNOTICE "${SENSORa} Data" "${SENSORa} is reporting data again"
|
||||
SENDNOTICE "${SENSOR_DESC} Data" "${SENSORa} is reporting data again"
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSORa} - Sensor is reporting data again" >> ${logtemp}
|
||||
fi
|
||||
[ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && rm -f ${PW_TMPFOLDER}/${SENSORa}*
|
||||
@@ -1013,8 +1014,8 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
|
||||
if [ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] || [ -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||
if [ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] || [ -f ${PW_TMPFOLDER}/${SENSOR}.restart ]; then
|
||||
SENDNOTICE "${SENSOR} Data" "${SENSOR} is reporting data again"
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} - Sensor is reporting data again" >> ${logtemp}
|
||||
SENDNOTICE "${SENSOR_DESC} Data" "${SENSOR_DESC} is reporting data again"
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR_DESC} - Sensor is reporting data again" >> ${logtemp}
|
||||
fi
|
||||
rm -f ${PW_TMPFOLDER}/${SENSOR}*
|
||||
fi
|
||||
@@ -1146,7 +1147,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
|
||||
if [[ "${SENSORa}" != *"-Usage"* ]] && [[ "${SENSORa}" != *"FAN"* ]] && (( $(bc <<< "${temp_f} < ${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_DESC} BACK TO NORMAL" "NORMAL TEMP: ${temp_f}${GAUGESH}
|
||||
Previous Temp: ${last_temp}${GAUGESH}"
|
||||
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Back to NORMAL ${GAUGE} - Previous ${GAUGE}: ${last_temp}${GAUGESH}" >> ${logtemp}
|
||||
# [ "$(compgen -G "${PW_TMPFOLDER}/power.*.off")" != "" ] && rm -f ${PW_TMPFOLDER}/power.*.off
|
||||
@@ -1192,7 +1193,7 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/temp.warn.${SENSOR}.pre)) -ge 120 ]; then
|
||||
# if (( $(bc <<< "${temp_diff} >= 1") )); then
|
||||
touch ${PW_TMPFOLDER}/temp.warn.${SENSOR}.pre
|
||||
SENDNOTICE "${SENSOR} ${GAUGE} WARNING" "WARNING ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1
|
||||
SENDNOTICE "${SENSOR_DESC} ${GAUGE} WARNING" "WARNING ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1
|
||||
if [ "${last_temp}" != "${temp_f}" ]; then
|
||||
last_temp=${temp_f}
|
||||
echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR}
|
||||
@@ -1209,9 +1210,9 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/temp.crit.${SENSOR}.pre)) -ge 120 ]; then
|
||||
# if (( $(bc <<< "${temp_diff} >= 1") )); then
|
||||
touch ${PW_TMPFOLDER}/temp.crit.${SENSOR}.pre
|
||||
SENDNOTICE "${SENSOR} ${GAUGE} CRITICAL" "CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1
|
||||
SENDNOTICE "${SENSOR_DESC} ${GAUGE} CRITICAL" "CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 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}${GAUGESH})" >> ${PW_LOGFILE}
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR_DESC} - ${temp_f}${GAUGESH} - CRITICAL ${GAUGE} - (Difference of ${temp_diff}${GAUGESH})" >> ${PW_LOGFILE}
|
||||
if [ "${last_temp}" != "${temp_f}" ]; then
|
||||
last_temp=${temp_f}
|
||||
echo ${last_temp} >| ${PW_TMPFOLDER}/.lasttemp/${SENSOR}
|
||||
@@ -1236,7 +1237,7 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/temp.critsys.${SENSOR}.pre)) -ge 120 ]; then
|
||||
# if (( $(bc <<< "${temp_diff} >= 1") )); then
|
||||
touch ${PW_TMPFOLDER}/temp.critsys.${SENSOR}.pre
|
||||
SENDNOTICE "${SENSOR} TEMP CRITICAL" "SYSTEM CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1
|
||||
SENDNOTICE "${SENSOR_DESC} TEMP CRITICAL" "SYSTEM CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 1
|
||||
# [ $(bc -l <<< "${temp_diff} >= 5") -eq 1 ] && SENDNOTICE "${SENSOR} TEMP CRITICAL" "SYSTEM CRITICAL ${GAUGE}: ${temp_f}${GAUGESH} - (Difference of ${temp_diff}${GAUGESH})" 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}${GAUGESH})" >> ${PW_LOGFILE}
|
||||
@@ -1298,7 +1299,7 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && (([ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]) || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ])); then
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp}
|
||||
if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then
|
||||
SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1
|
||||
SENDNOTICE "${SENSOR_DESC} Sensor ERROR" "ERROR reading sensor data" 1
|
||||
touch ${PW_TMPFOLDER}/${SENSOR}-error.sent
|
||||
fi
|
||||
fi
|
||||
@@ -1372,7 +1373,7 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ]); then
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp}
|
||||
if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then
|
||||
SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1
|
||||
SENDNOTICE "${SENSOR_DESC} Sensor ERROR" "ERROR reading sensor data" 1
|
||||
touch ${PW_TMPFOLDER}/${SENSOR}-error.sent
|
||||
fi
|
||||
fi
|
||||
@@ -1413,7 +1414,7 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
elif [ ! -f ${PW_TMPFOLDER}/${SENSORa}.disable ] && (([ ! -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}-error.reading)) -ge 60 ]) || ([ -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ])); then
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSORa} Sensor - ERROR reading sensor data" >> ${logtemp}
|
||||
if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSORa}-error.sent ]; then
|
||||
SENDNOTICE "${SENSORa} Sensor ERROR" "ERROR reading sensor data" 1
|
||||
SENDNOTICE "${SENSOR_DESC} Sensor ERROR" "ERROR reading sensor data" 1
|
||||
touch ${PW_TMPFOLDER}/${SENSORa}-error.sent
|
||||
fi
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ] && [ -f ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.lastfancheck/${SENSORa}.set)) -ge 900 ]; then
|
||||
|
||||
Reference in New Issue
Block a user