NUT with UPS shutdown

mcfly9

Member
May 11, 2022
26
2
8
I have installed nut on proxmox and managed to define the UPS. NUT successfuly executed a FSD, but not sure how to actually turn off the UPS, so an automatic poweron after power has returned would be executed.

What I don't fully understand:
1) Do I need to manually call upsdrvctl shutdown in some shutdown scripts? Am I supposed to do it in upssched-cmd?
2) When testing the shutdown sequence, I see that the UPS driver seems to be shutting down before the VM's are actually shut down. Is this correct? Why not after the VM's have stopped? Is there any way to get a callback after VM shutdown to initiate UPS shutdown?

Code:
Dec 11 16:13:17 proxmox-sz upsmon[1211]: UPS apc@localhost battery is low
Dec 11 16:13:17 proxmox-sz upsd[1208]: Client upsadmin@127.0.0.1 set FSD on UPS [apc]
Dec 11 16:13:17 proxmox-sz upssched[13178]: Executing command: lowbatt
Dec 11 16:13:17 proxmox-sz upssched-cmd: UPS on battery critical, forced shutdown
Dec 11 16:13:22 proxmox-sz upsmon[1211]: Executing automatic power-fail shutdown
Dec 11 16:13:22 proxmox-sz upsmon[1211]: Auto logout and shutdown proceeding
Dec 11 16:13:22 proxmox-sz upssched[13197]: Executing command: powerdown
Dec 11 16:13:22 proxmox-sz upssched-cmd: powerdown command
Dec 11 16:13:23 proxmox-sz systemd[1]: nut-monitor.service: Succeeded.
...
Dec 11 16:14:25 proxmox-sz systemd[1]: Stopping PVE guests...
...
Dec 11 16:18:30 proxmox-sz systemd[1]: Stopped PVE guests.
 
  1. Yes, you need to manually call upsdrvctl shutdown in your shutdown scripts. You can do this in upssched-cmd by adding the command to the shutdown command in your upsmon.conf file.
  2. The UPS driver is shutting down before the VM's because it is following the order of events specified in the shutdown sequence. If you want the UPS to shut down after the VM's, you can modify the shutdown sequence in your upsmon.conf file to reflect this. Alternatively, you can try using a callback function in your shutdown scripts to initiate the UPS shutdown after the VM's have stopped.
 
Thanks, I'll be able to test it later this week. I did some traces though of NUT initiating UPS shutdown in systemd scripts:

Code:
root@proxmox-sz:~# cat /lib/systemd/system-shutdown/nutshutdown
#!/bin/sh
/sbin/upsmon -K >/dev/null 2>&1 && /sbin/upsdrvctl shutdown
 
  1. Yes, you need to manually call upsdrvctl shutdown in your shutdown scripts. You can do this in upssched-cmd by adding the command to the shutdown command in your upsmon.conf file.
  2. The UPS driver is shutting down before the VM's because it is following the order of events specified in the shutdown sequence. If you want the UPS to shut down after the VM's, you can modify the shutdown sequence in your upsmon.conf file to reflect this. Alternatively, you can try using a callback function in your shutdown scripts to initiate the UPS shutdown after the VM's have stopped.
To have proxmox shutdown full first , before the ups going down... What do you put in your config, in the nut server? You add a delay..? Like did you install the nut client on prox just as is , with no upssched.conf ..
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!