Update powerwall.sh
This commit is contained in:
12
powerwall.sh
12
powerwall.sh
@@ -35,10 +35,6 @@ CHECKTEMP(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHECKTEMP_SERVICE(){
|
CHECKTEMP_SERVICE(){
|
||||||
for ESXIHOST in "${ESXIHOSTS[@]}"; do
|
|
||||||
echo "Host: ${ESXIHOST}"
|
|
||||||
done
|
|
||||||
|
|
||||||
last_temp=0
|
last_temp=0
|
||||||
mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
||||||
while true
|
while true
|
||||||
@@ -74,9 +70,15 @@ CHECKTEMP_SERVICE(){
|
|||||||
|
|
||||||
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
||||||
if [ $temp_diff -gt 1 ] || [ $last_temp -eq 1 ]; then
|
if [ $temp_diff -gt 1 ] || [ $last_temp -eq 1 ]; then
|
||||||
echo "($datetime) CRITICAL TEMP: ${temp_f}°F - (Difference of ${temp_diff}°)" | mail -s "${1} TEMP CRITICAL" $email_alert
|
echo -e "($datetime) CRITICAL TEMP: ${temp_f}°F - (Difference of ${temp_diff}°)\nShutting down servers!!" | mail -s "${1} TEMP CRITICAL" $email_alert
|
||||||
echo "alert sent"
|
echo "alert sent"
|
||||||
last_temp=$temp_f
|
last_temp=$temp_f
|
||||||
|
|
||||||
|
for ESXIHOST in "${ESXIHOSTS[@]}"; do
|
||||||
|
echo "Shutting Down: ${ESXIHOST}"
|
||||||
|
/usr/bin/ssh root@${ESXIHOST} "/vmfs/volumes/iSCSI2-Datastore2\ \(R5\)\(1-4\)/\!SCRIPTS/esxidown/async.sh"
|
||||||
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
echo "($datetime) CRITICAL: ${temp_f}°F - (Difference of ${temp_diff}°)"
|
echo "($datetime) CRITICAL: ${temp_f}°F - (Difference of ${temp_diff}°)"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user