NUT configuration issues - v8.2.4

boomam

Member
Jan 5, 2023
58
10
8
Hi,
Does anyone know if there is something in Proxmox that would prevent NUT from work correctly?
I've got a set of config files i usually drop onto systems, that i adjust slightly dependent on needs, but for some reason they just do not want to work with Proxmox systems.

I do get the note in the log about the system now being on battery power, but then it literally does nothing.
So the systems are definitely able to see the state changes from the system hosting the UPS.
There's also nothing untoward in the log for service nut-monitor statusother than a "Could not find PID file to see if previous upsmon instance is already running!" note

To be clear on my objective - each system shuts down on a different % level.

If anyone can shed some light on what's going on, it would be much appreciated.

Thanks!

---
Below are my current nut configs, for reference -

nut.conf
Code:
MODE=netclient

ups.conf - note, set at 90 for testing purposes
Code:
battery.charge.low = 90

upsmon.conf - note, FINALDELAY set to 5 for testing
Code:
RUN_AS_USER root                                                                                                                                                                                                                                                                              
MONITOR ups01@1.2.3.4 1 client supersecret slave                                                                                                                                                                                        
                                                                                                                                                                                                                                               
MINSUPPLIES 1                                                                                                                                                                                                                                  
SHUTDOWNCMD "/sbin/shutdown -h now"                                                                                                                                                                                                            
NOTIFYCMD /usr/sbin/upssched                                                                                                                                                                                                                                                      
POWERDOWNFLAG /etc/killpower                                                                                                                                                                                                                   
POLLFREQ 15                                                                                                                                                                                                                                    
POLLFREQALERT 5                                                                                                                                                                                                                                
#HOSTSYNC 15                                                                                                                                                                                                                                   
RBWARNTIME 43200                                                                                                                                                                                                                               
NOCOMMWARNTIME 120                                                                                                                                                                                                                             
DEADTIME 45                                                                                                                                                                                                                                    
FINALDELAY 5                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                               
# Notification Messages                                                                                                                                                                                                                        
NOTIFYMSG ONLINE    "UPS %s on line power"                                                                                                                                                                                                     
NOTIFYMSG ONBATT    "UPS %s on battery"                                                                                                                                                                                                        
NOTIFYMSG LOWBATT   "UPS %s battery is low"                                                                                                                                                                                                    
NOTIFYMSG FSD       "UPS %s: forced shutdown in progress"                                                                                                                                                                                      
NOTIFYMSG COMMOK    "Communications with UPS %s established"                                                                                                                                                                                   
NOTIFYMSG COMMBAD   "Communications with UPS %s lost"                                                                                                                                                                                          
NOTIFYMSG SHUTDOWN  "Auto logout and shutdown proceeding"                                                                                                                                                                                      
NOTIFYMSG REPLBATT  "UPS %s battery needs to be replaced"                                                                                                                                                                                      
NOTIFYMSG NOCOMM    "UPS %s is unavailable"                                                                                                                                                                                                    
NOTIFYMSG NOPARENT  "upsmon parent process died - shutdown impossible"                                                                                                                                                                                                                                                                            
# Notification Actions                                                                                                                                                                                                                         
NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG LOWBATT  SYSLOG+WALL                                                                                                                                                                                                                
NOTIFYFLAG FSD      SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG COMMOK   SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG COMMBAD  SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG REPLBATT SYSLOG+WALL                                                                                                                                                                                                                
NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC                                                                                                                                                                                                           
NOTIFYFLAG NOPARENT SYSLOG+WALL

upssched-cmd
Code:
#!/bin/sh                                                                                                                                                                                                                                      
 case $1 in                                                                                                                                                                                                                                    
       onbatt)                                                                                                                                                                                                                                 
          logger -t upssched-cmd "UPS running on battery"                                                                                                                                                                                      
          ;;                                                                                                                                                                                                                                   
       earlyshutdown)                                                                                                                                                                                                                          
          logger -t upssched-cmd "UPS on battery too long, early shutdown"                                                                                                                                                                     
          /usr/sbin/upsmon -c fsd                                                                                                                                                                                                              
          ;;                                                                                                                                                                                                                                   
       shutdowncritical)                                                                                                                                                                                                                       
          logger -t upssched-cmd "UPS on battery critical, forced shutdown"                                                                                                                                                                    
          /usr/sbin/upsmon -c fsd                                                                                                                                                                                                              
          ;;                                                                                                                                                                                                                                   
       upsgone)                                                                                                                                                                                                                                
          logger -t upssched-cmd "UPS has been gone too long, can't reach"                                                                                                                                                                     
          ;;                                                                                                                                                                                                                                   
       *)                                                                                                                                                                                                                                      
          logger -t upssched-cmd "Unrecognized command: $1"                                                                                                                                                                                    
          ;;                                                                                                                                                                                                                                   
 esac

upssched.conf
Code:
CMDSCRIPT /etc/nut/upssched-cmd                                                                                                                                                                                                                
PIPEFN /etc/nut/upssched.pipe                                                                                                                                                                                                                  
LOCKFN /etc/nut/upssched.lock
I have also tested upssched.conf with AT 90% "shutdowncritical"
 
ups.conf - note, set at 90 for testing purposes
Code:
battery.charge.low = 90

Is the proxmox machine a NUT master/primary (ie it's the machine directly connected to the ups) or NUT slave/secondary?

And if it is a slave/secondary, is this the ups.conf setting from the file on the proxmox machine, or the NUT master/primary machine?

If the proxmox machine is the slave/secondary, and this ups.conf is on the proxmox machine, then this config will not do anything. The NUT master/primary is the one that announces state, so it is the one that would have to set battery.charge.low = 90 for your test.

I suspect you were hoping that you could set these values on the clients to react differently to the raw UPS values, but unfortunately the stack doesn't behave that way.
 
Is the proxmox machine a NUT master/primary (ie it's the machine directly connected to the ups) or NUT slave/secondary?

And if it is a slave/secondary, is this the ups.conf setting from the file on the proxmox machine, or the NUT master/primary machine?

If the proxmox machine is the slave/secondary, and this ups.conf is on the proxmox machine, then this config will not do anything. The NUT master/primary is the one that announces state, so it is the one that would have to set battery.charge.low = 90 for your test.

I suspect you were hoping that you could set these values on the clients to react differently to the raw UPS values, but unfortunately the stack doesn't behave that way.
Its the config for the slave, the master is a separate system.

For the moment, I've done it all with a shell script on the master, seems to work well in testing.
 
I've started experimenting myself with setting up "tiers of shutdown", trying to avoid scripting.
I haven't finished the setup yet, but the idea is to use repeaters of my main ups using the dummy-ups driver, and combining that with the ignorelb config and overriding the low battery/runtime levels on the repeaters, then having secondary/slave devices listen to just one of the tiers for the low battery announcement to start shutting down.

Here's an example ups.conf i've written for the primary (the one actually interfacing with the UPS), but still have to finish configuring the secondary machines and testing:
Code:
[actualUps]
  driver = usbhid-ups
  port = auto
  vendorid = ****
  productid = ****

[storageTier]
  driver = dummy-ups
  port = actualUps@localhost
  desc = "Repeater of actualUps with overrides for storage stage shutdown"
  ignorelb = true
  override.battery.charge.low = 20
  override.battery.runtime.low = 600

[computeTier]
  driver = dummy-ups
  port = actualUps@localhost
  desc = "Repeater of actualUps with overrides for compute stage shutdown"
  ignorelb = true
  override.battery.charge.low = 30
  override.battery.runtime.low = 900
 

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!