NUT UPS on Container

Depending on your UPS device, a lot of info is available & reported to the NUT server/client, including battery state & amounts . Based on this info - any command should be available using the regular commands. Probing your UPS/NUT devices will show you the way.
 
Depending on your UPS device, a lot of info is available & reported to the NUT server/client, including battery state & amounts . Based on this info - any command should be available using the regular commands. Probing your UPS/NUT devices will show you the way.
I think I have my Secondary working. At least during the test it shutdown after 15 min as instructed to (though I think I'll be setting it to 10min).

The Primary (Server) on the other hand did nothing.
I've changed the upssched-cmd with the ssh-shutdown command to shutdown the host but it's doing nothing. Same goes for the command that shuts up the beeper after 5 min.

What I'm trying to achieve is that my systems shutdown, but I don't want my UPS to powerdown
What am I missing here?

My upssched-cmd:
Code:
       onbatt_shutdown)
          logger -t upssched-cmd "UPS on battery too long (45 min), system shutting down"
          ssh -i /root/.ssh/20241109_NUT -p 9447 -o StrictHostKeyChecking=no root@192.168.x.xx -t '/sbin/shutdown -h +0'
          ;;
       mute_beeper)
          logger -t upssched-cmd "5 minute limit exeeded, muting beeper"
          upscmd -u upsuser -p <password> apc900@192.168.x.xx beeper.mute

My upssched.conf:
Code:
# Send alerts immediately on change in line power
AT ONBATT * START-TIMER onbatt 30
AT ONLINE * CANCEL-TIMER onbatt online


# (Optional) Silence the beeper after 5 minutes
AT ONBATT * START-TIMER mute_beeper 300
AT ONLINE * CANCEL-TIMER mute_beeper


# Shutdown after 15 minutes on battery (45 * 60 = 2700)
AT ONBATT * START-TIMER onbatt_shutdown 2700


# Cancel system shutdown timer if power's restored
AT ONLINE * CANCEL-TIMER onbatt_shutdown

AT LOWBATT * EXECUTE onbatt

AT COMMBAD * START-TIMER commbad 30
AT COMMOK * CANCEL-TIMER commbad commok
AT NOCOMM * EXECUTE commbad
AT SHUTDOWN * EXECUTE powerdown


# Battery replacement indicated by cron'd quick test
AT REPLBATT * EXECUTE replace_batt
 
I think I have my Secondary working. The Primary (Server) on the other hand did nothing.
Not sure what you refer to as Primary & Secondary. In the Networkupstools (NUT) environment they refer to Primary as a system that should be shutdown after a Secondary one, (as described in the upsmon.conf file).

IDW how you setup the NUT server/client system, but if I understood correctly you did all of this within an LXC on a Proxmox Host Node without changing anything within the Host Node. (You probably achieved this with USB passthrough to the LXC, or possibly you have a Network-connected UPS). If this is indeed the case, then AFAIK you would simply enter the desired shutdown (SSH) command within the /nut/upsmon.conf file in the LXC, so that in fact the server will shutdown when it receives this command.

Same goes for the command that shuts up the beeper after 5 min.
You need to test your UPS capabilities, (sending the command manually?) if in fact it is capable of this.

ssh -i /root/.ssh/20241109_NUT -p 9447 -o StrictHostKeyChecking=no root@192.168.x.xx -t '/sbin/shutdown -h +0'
When you enter this command (manually) in the LXC, does it shutdown your Host server?

I must be honest - most of your queries/questions here are not Proxmox-centric, and would therefore be better addressed in NUT/UPS forum etc.

In my setup - I don't really use all the bells & whistles of the Networkupstools - But I simply setup a NUT server on the Host itself (the only inevitable big change I made within the Host), & I have a client within a VM (Home Assistant) that monitors the NUT server & reports/takes actions (shutdown etc.). I find I have absolute granular (programmable) control this way. (OL/OB/LB etc.).

Anyway, I wish you much luck, I'm pretty sure you'll find the right way to proceed.
 
  • Like
Reactions: Pato_77
Not sure what you refer to as Primary & Secondary. In the Networkupstools (NUT) environment they refer to Primary as a system that should be shutdown after a Secondary one, (as described in the upsmon.conf file).

IDW how you setup the NUT server/client system, but if I understood correctly you did all of this within an LXC on a Proxmox Host Node without changing anything within the Host Node. (You probably achieved this with USB passthrough to the LXC, or possibly you have a Network-connected UPS). If this is indeed the case, then AFAIK you would simply enter the desired shutdown (SSH) command within the /nut/upsmon.conf file in the LXC, so that in fact the server will shutdown when it receives this command.


You need to test your UPS capabilities, (sending the command manually?) if in fact it is capable of this.


When you enter this command (manually) in the LXC, does it shutdown your Host server?

I must be honest - most of your queries/questions here are not Proxmox-centric, and would therefore be better addressed in NUT/UPS forum etc.

In my setup - I don't really use all the bells & whistles of the Networkupstools - But I simply setup a NUT server on the Host itself (the only inevitable big change I made within the Host), & I have a client within a VM (Home Assistant) that monitors the NUT server & reports/takes actions (shutdown etc.). I find I have absolute granular (programmable) control this way. (OL/OB/LB etc.).

Anyway, I wish you much luck, I'm pretty sure you'll find the right way to proceed.
Thank you for your time to respond.

Just to confirm your assumptions:
- Primary and Secondary refers to Master and Slave setup. Terminology has changed somewhere in the last 2 or 3 years from what I've read in the documentation and on GitHub.
- Yes, I have the NUT server running in an LXC by passing through the USB port where the UPS is connected to
- The mentioned SSH shutdown command works perfectly when I enter this in the LXC's Cli. The host shuts down with no problems.
- The beeper.mute command also works when I enter this into the Cli of the LXC (this command stays in the LXC because it's the NUT Server that would send this command to the UPS.

I'm going to check a NUT/UPS forum for these questions. Thank you for the help. I also have Home Assistant running, and your answer gives food-for-thought :)
 
Last edited:

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!