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

Roger Price roger at rogerprice.org
Sat Sep 10 18:28:35 UTC 2016


On Thu, 8 Sep 2016, Jeff Bowman wrote:

> That said, is there a way to manually poll the driver for UPS/power line 
> status? I ask because I can foresee a scenario such as this:
...
> So I'd like to be able to remote in and check the status to make sure 
> everything is OK. If not, then I can manually run my shutdown 
> script/process and start the cycle all over again. (Note: running 'upsc 
> ups at localhost' echoes only a blank line to the screen, as do both 
> 'upsmon' and 'upsd.')

Something is wrong here.  Is the daemon upsd running?  On a Unix/Linux 
system, the command ps aux | grep ups gives the report

  upsd 3196  0.0  0.0  13228   880 ? Ss août30   2:14 /usr/lib/ups/driver/usbhid-ups -a Eaton-66781
  upsd 3200  0.0  0.0  17560   736 ? Ss août30   0:49 /usr/sbin/upsd -u upsd
  root 3203  0.0  0.0  19432   664 ? Ss août30   0:00 /usr/sbin/upsmon
  upsd 3204  0.0  0.0  19856  1612 ? S  août30   0:41 /usr/sbin/upsmon

I don't have any Windows boxes, but I guess there is a similar command on 
Windows.  What does it show?

Is it possible to ssh into the system which runs NUT, and then run command 
"upsc <myups>"?

> So to confirm my understanding: You're stating that I'll want to do this 
> via NOTIFYFLAG ONBATT SYSLOG+EXEC and NOTIFYCMD (no WALL in Windows), 
> using that combination to run my script/process and skipping SHUTDOWNCMD 
> altogether--correct?

Remember that I don't use windows or the LB status so my suggestion is 
only a suggestion.  Above all, you need to test thoroughly with your 
system and your UPS.

Given that a perfect data set is mission critical for you, I would 
recommend having a test rig where you can check that you can handle 
wall power return at every phase of NUT action.

> Sounds good. Next up: how to then send the 'delayed shutdown' command to 
> the UPS hardware itself? Does the driver automatically handle that?

The command upsdrvctl shutdown does this.  See man upsdrvctl.

> I'd like everything to occur shortly after the OB signal, so as to 
> preserve battery as much as possible.

"Shortly after" means using timers. If you want to preserve the battery 
charge, but not use timers, you need to use a combination of OB and LB and 
set your LB level high using a command such as

  upsrw -s battery.charge.low=60 -u upsmaster -p sekret my-ups

Roger


More information about the Nut-upsuser mailing list