update
This commit is contained in:
@@ -13,6 +13,8 @@ min_battvolt=49
|
||||
min_battvolt_sys=47
|
||||
#47
|
||||
|
||||
FOLDER='/opt/idssys/powerwall'
|
||||
logfile=${FOLDER}/logfile
|
||||
|
||||
declare -A TEMP_THRESHOLDS
|
||||
TEMP_THRESHOLDS['ServerRoomTH']="83,88,95"
|
||||
|
||||
27
powerwall.sh
27
powerwall.sh
@@ -2,10 +2,9 @@
|
||||
# powerwall - CLI commands to control VM guest power
|
||||
|
||||
action="$1"
|
||||
FOLDER='/opt/idssys/powerwall'
|
||||
|
||||
source $FOLDER/defaults.inc
|
||||
source $FOLDER/powerwall.conf
|
||||
source /opt/idssys/powerwall/defaults.inc
|
||||
source /opt/idssys/powerwall/powerwall.conf
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
|
||||
@@ -139,39 +138,39 @@ CHECKACV_SERVICE(){
|
||||
datetime=`date +'%Y-%m-%d %H:%M:%S'`
|
||||
if [ ${INPUTACV} -ge ${min_acvolt} ]; then
|
||||
if [ $voltstatus -eq 3 ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) back to normal voltage: ${INPUTACV}V"
|
||||
echo "($datetime) back to normal voltage: ${INPUTACV}V" >> ${logfile}
|
||||
echo -e "($datetime) Normal voltage detected\nVOLTAGE: ${INPUTACV}V" | mail -s "POWER NOMINAL AGAIN" $email_alert
|
||||
[ $VERBOSE = true ] && echo "($datetime) alert sent"
|
||||
echo "($datetime) alert sent" >> ${logfile}
|
||||
battstatus=0
|
||||
else
|
||||
[ $VERBOSE = true ] && echo "($datetime) normal voltage: ${INPUTACV}V"
|
||||
[ $VERBOSE = true ] && echo "($datetime) normal voltage: ${INPUTACV}V" >> ${logfile}
|
||||
if [ $voltstatus -eq 0 ]; then
|
||||
echo -e "($datetime) Service Startup\nNormal voltage detected\nVOLTAGE: ${INPUTACV}V" | mail -s "Power Nominal" $email_alert
|
||||
[ $VERBOSE = true ] && echo "($datetime) alert sent"
|
||||
echo "($datetime) alert sent" >> ${logfile}
|
||||
fi
|
||||
fi
|
||||
voltstatus=1
|
||||
else
|
||||
[ $VERBOSE = true ] && echo "($datetime) LOW voltage: ${INPUTACV}V"
|
||||
echo "($datetime) LOW voltage: ${INPUTACV}V" >> ${logfile}
|
||||
if [ $voltstatus -lt 3 ]; then
|
||||
echo -e "($datetime) Power off or low voltage detected\nVOLTAGE: ${INPUTACV}V\nBATT VOLTAGE: ${BATTVOLT}V" | mail -s "POWER ALERT - LOW POWER!!" $email_alert
|
||||
[ $VERBOSE = true ] && echo "($datetime) alert sent"
|
||||
echo "($datetime) alert sent" >> ${logfile}
|
||||
last_battvolt=$BATTVOLT
|
||||
fi
|
||||
voltstatus=3
|
||||
if [ ${BATTVOLT%.*} -lt ${min_battvolt} ] && [ ${BATTVOLT%.*} -gt ${min_battvolt_sys} ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) LOW BATTERY voltage: ${BATTVOLT}V"
|
||||
echo "($datetime) LOW BATTERY voltage: ${BATTVOLT}V" >> ${logfile}
|
||||
if [ $battstatus -lt 2 ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) Shutting down main servers..."
|
||||
echo "($datetime) Shutting down main servers..." >> ${logfile}
|
||||
echo -e "($datetime) Battery Voltage LOW: ${BATTVOLT}V\nShutting down main servers" | mail -s "BATT-VOLT LOW: SHUTDOWN SERVERS" $email_alert
|
||||
SHUTDOWN_SERVERS MAIN
|
||||
battstatus=2
|
||||
fi
|
||||
|
||||
elif [ ${BATTVOLT%.*} -le ${min_battvolt_sys} ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) SYSTEM LOW BATTERY voltage: ${BATTVOLT}V"
|
||||
echo "($datetime) SYSTEM LOW BATTERY voltage: ${BATTVOLT}V" >> ${logfile}
|
||||
if [ $battstatus -lt 3 ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) Shutting down all remaining servers..."
|
||||
echo "($datetime) Shutting down all remaining servers..." >> ${logfile}
|
||||
echo -e "($datetime) Battery Voltage REALLY LOW: ${BATTVOLT}V\nShutting down all servers" | mail -s "BATT-VOLT REALLY LOW: SHUTDOWN SERVERS" $email_alert
|
||||
SHUTDOWN_SERVERS SYS
|
||||
curl --data "cmd=PWRoff" http://10.10.0.61/cmd
|
||||
@@ -180,7 +179,7 @@ CHECKACV_SERVICE(){
|
||||
fi
|
||||
|
||||
else
|
||||
[ $VERBOSE = true ] && echo "($datetime) Battery Voltage: ${BATTVOLT}V"
|
||||
[ $VERBOSE = true ] && echo "($datetime) Battery Voltage: ${BATTVOLT}V" >> ${logfile}
|
||||
|
||||
battstatus=1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user