[Nut-upsuser] How to get started (Windows)

Roger Price roger at rogerprice.org
Thu Sep 8 14:46:50 UTC 2016


On Thu, 8 Sep 2016, Jeff Bowman wrote:

> I’ve been able to get the latest Windows port installed on my Hyper-V 2012 R2 instance and start the service.
> 
> But as I’m an absolute beginner I’m not sure how to proceed further. I’ve browsed the archives, but discussions here tend to assume at least an
> intermediate level of understanding; thus it’s still quite a bit over my head. Your patience and slow explanations are appreciated.
> 
> 1. CLI error: I get an error when running ‘upsdrvctl start’: “Can't claim USB device [051d:0003]: libusb0-dll:err [claim_interface] could not claim
> interface 0, win error: The requested resource is in use.”
> 
> 2. Event log errors: As noted the service starts fine, but I’m getting these two errors on service stop--“Error stopping upsd (2)” and “Error stopping
> upsmon (2).”
> 
> 3. I don’t understand what’s meant by “shutting down the UPS.” (e.g. upsdrvctl,
> http://lists.alioth.debian.org/pipermail/nut-upsuser/2015-April/009652.html) Why would we want to do that? It should be the other way around--the UPS
> stays running while the computer shuts down--no? Please clarify.

It's assumed in the NUT world that you are running a server which is a) to 
be shut down when wall power fails for too long, and which is b) to be 
brought back into service automatically when wall power finally returns.

a) is shutting down the server using the SHUTDOWNCMD

b) is more subtle.  After, and I repeat _after_, the server has shut down, 
the UPS unit must be put into a state where is can react to the return of 
wall power, and signal the server to restart.  A UPS which is left beeping 
cannot do that.  To get the server going again it is necessary to perform 
a "delayed shutdown" of the UPS unit itself.  This might be some 30 
seconds after the server has shut down.  Once the UPS unit is itself 
shutdown, it will react to a return of wall power by applying power supply 
to the server, and the server will, if the BIOS is set up correctly, power 
up, and resume duty.

The use of the term "shutdown" for both the server and the UPS unit is not 
the happiest choice, but we live with it.

> 4. What’s next? I’d like to configure things to run a simple batch file after [x] minutes of on-battery time.

There are two schools of thought for managing wall power loss.

  Optimist: Keep going as long as possible on battery and turn off the 
server when the low-battery signal is received.  No timer needed,  This is 
the simplest approach.

  Pessimist: Whenever OB is received, start timers to shut down the server 
after a short interval. Expect wall power to return and then fail again. 
Hope that the battery will recover enough between failures for the next 
shutdown.  This is for people with unreliable wall power supplies.  Using 
timers is more complicated.

If you want simplicity, use the LB state as your guide, and set up your 
upsmon.conf to react to it.  ( I don't do this, so the following is 
speculative. ) In upsmon.conf set

  NOTIFYMSG  LOWBATT "Power failure - system is shutting down"
  NOTIFYFLAG LOWBATT SYSLOG+EXEC+WALL
  NOTIFYCMD  /path/to/your/system-shutdown-batch-file

You don't use upssched.

If you want timers, look at http://rogerprice.org/NUT.html which contains 
a fully worked example.  It's more complicated.  You have been warned.

Roger


More information about the Nut-upsuser mailing list