more small changes
This commit is contained in:
parent
2be84fb566
commit
3e39ba13f3
13
power.py
13
power.py
@ -47,7 +47,7 @@ proxmox = ProxmoxAPI(pve_host, user=pve_user, password=pve_pass, verify_ssl=Fals
|
||||
def shutdown_pve(node):
|
||||
try:
|
||||
proxmox.nodes(node).status.post(command='shutdown')
|
||||
logger.warning("Node {node} is shutting down.")
|
||||
logger.warning(f"Node {node} is shutting down.")
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
@ -133,9 +133,7 @@ def main():
|
||||
if status and status != prev_status:
|
||||
if status == "OB DISCHRG":
|
||||
pwr_offline(battery)
|
||||
elif status == "OL":
|
||||
pwr_online(battery)
|
||||
elif status == "OL CHRG":
|
||||
elif status == "OL" or status == "OL CHRG":
|
||||
pwr_online(battery)
|
||||
else:
|
||||
logger.info(f"UPS status changed to: {status}")
|
||||
@ -143,9 +141,10 @@ def main():
|
||||
elif status == "OB DISCHRG" and battery < 50:
|
||||
if battery < 25:
|
||||
batt_crit(battery)
|
||||
for node in pve_nodes:
|
||||
shutdown_pve(node)
|
||||
time.sleep(300)
|
||||
if ups_id == "Server":
|
||||
for node in pve_nodes:
|
||||
shutdown_pve(node)
|
||||
time.sleep(300)
|
||||
else:
|
||||
batt_low(battery)
|
||||
time.sleep(60)
|
||||
|
Loading…
Reference in New Issue
Block a user