NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

dbott67's avatar
dbott67
Guide
Mar 03, 2008

Using the ReadyNAS to create a Network UPS for PCs

The ReadyNAS can issue "UPS commands" to other devices, effectively allowing your UPS to be networked and shutdown client PCs. I've got my UPS connected to the NAS and setup using the procedure below.

Basically, you need to install WinNUT on your PC.

You also need to configure your ReadyNAS to communicate with the PC:

1. Connect the UPS to the NAS via USB.
2. Login to the web interface of your NAS.
3. Click SYSTEM --> POWER.
4. Scroll down to the UPS section.
5. Check the box that says "Enable network sharing of attached UPS"
6. Enter the IP address of the PC or the subnet (i.e. 192.168.1.0/24).



7. Edit the WinNUT configuration file (typically C:\Program Files\WinNUT\upsmon.conf). In my case, my ReadyNAS uses a static IP (192.168.1.2) and my computers use DHCP on the 192.168.1.0/24 subnet). I've edited out most author comments, just leaving the values I used:
# --------------------------------------------------------------------------
# MONITOR <system> <powervalue> <username> <password> ("master"|"slave")

MONITOR UPS@192.168.1.2 1 monuser pass slave

# --------------------------------------------------------------------------
# MINSUPPLIES <num>

MINSUPPLIES 1

# --------------------------------------------------------------------------
# NOTIFYCMD <command>

NOTIFYCMD "c:\\Program Files\\WinNUT\\alertPopup.exe"

# --------------------------------------------------------------------------
# POLLFREQ <n>

POLLFREQ 5

# --------------------------------------------------------------------------
# POLLFREQALERT <n>

POLLFREQALERT 5

# --------------------------------------------------------------------------
# HOSTSYNC - How long upsmon will wait before giving up on another upsmon

HOSTSYNC 15

# --------------------------------------------------------------------------
# DEADTIME - Interval to wait before declaring a stale ups "dead"

DEADTIME 15

# --------------------------------------------------------------------------
# NOTIFYMSG - change messages sent by upsmon when certain events occur

NOTIFYMSG ONLINE "UPS %s is getting line power"
NOTIFYMSG ONBATT "Someone pulled the plug on %s"
NOTIFYMSG LOWBATT "UPS has a low battery"
NOTIFYMSG SHUTDOWN "The system is being shutdown"

# --------------------------------------------------------------------------
# NOTIFYFLAG - change behavior of upsmon when NOTIFY events occur

NOTIFYFLAG ONLINE EXEC
NOTIFYFLAG ONBATT EXEC
NOTIFYFLAG LOWBATT EXEC
NOTIFYFLAG SHUTDOWN EXEC

# --------------------------------------------------------------------------
# RBWARNTIME - replace battery warning time in seconds

RBWARNTIME 43200

# --------------------------------------------------------------------------
# NOCOMMWARNTIME - no communications warning time in seconds

NOCOMMWARNTIME 300

# --------------------------------------------------------------------------
# FINALDELAY - last sleep interval before shutting down the system

FINALDELAY 5


Here's a couple of screenshots from my PC when the UPS gets disconnected:






Read this thread for more information/background on networking a UPS device:

viewtopic.php?t=16348

-Dave

30 Replies

Replies have been turned off for this discussion
  • dbott67
    That post has very good info. I have a question for you.When you edit your configuration file,in the very first entry is the user and password the ones you use to access your ready nas?
    Also when click on apply on start Win nut I get a box that states insufficient power configured.Edit your configuration and change the values.This may be that my battery is low on the ups maybe not.Does it work for the Ready Nas Duo.Someone posted it does not.
  • Hello,

    I read this interesting thread but was unable to understand where my case does fit.
    I have an APC UPS connected to my Readynas Pro via USB and all is working fine.
    But now I am bringing in an additional Unraid NAS that will be connected to the same UPS.
    I would like to know how I can make the Readynas send a shutdown command to the Unraid server over the network every time the Readynas itself decides to shutdown following a long power drop?

    Thank you
  • xtrips wrote:
    I would like to know how I can make the Readynas send a shutdown command to the Unraid server over the network every time the Readynas itself decides to shutdown following a long power drop?


    I'm not familiar with Unraid, but if you can install "nut" on it you should be able to have it connect to the ReadyNAS over the network (and therefore respond to UPS events). Assuming it supports NUT, you need to do a few things:

    1. Plug the UPS into the Pro via USB.

    2. In Frontview on the Pro, go to SYSTEM > POWER and enable network sharing.

    3. Enter your network subnet in the "Hosts allowed access". For example, if the ReadyNAS and unRAID were on the 192.168.1.xxx subnet, you would enter the following:
    192.168.1.0/24


    4. Modify the nut config file on the unRAID box to point to the ReadyNAS.

    MONITOR UPS@ip.address.of.nas 1 monuser pass slave


    That's about it. From the ReadyNAS stand-point, it's pretty straight-forward. Getting "nut" to run on unRAID may be a challenge, but I'm assuming that it's using some variant of Linux so it should be doable.

    -Dave
  • I wonder if anyone can help me

    ReadyNas Duo, Win 7 Pro 64Bit, APC CS650 UPS

    I have the nas connected to the ups and everything works fine. I also want to shut down the PC as well as the NAS. I have read about the NUT tools and installed the windows installer version. I am now completley lost as how to set it up, if it can be done. I feel if I am banging my head against a brick wall, LOL. I am pretty well pc literate. Thanks
  • I'm having some difficulty figuring out if I'm doing it right or wrong...

    I have "MONITOR UPS@192.168.0.230 1 monuser pass slave" in my Winnut settings, like most people here, but I don't know if this applies to my setup.

    I have a RNDU6000 NAS and an APC BE700G-GR UPS.
    Do all the UPS's use 'UPS' as the name?
    The IP is the IP for my NAS, that's the only thing I was sure about *gg*.
    But then there's the login/pw... do I ALWAYS use this monuser/pass combo? (and why?) Or do I fill in what I use in my NAS? (login admin, PW {somethingsecret}), Or perhaps my main computer login/PW?

    My logfile for when I use the monuser/pass combo says:

    Level INFO 09/22/2011 05:44:42 Detected OS as Windows NT
    Level NOTICE 09/22/2011 05:44:42 Network UPS Tools upsmon 2.0.0b
    Level INFO 09/22/2011 05:44:42 UPS: UPS@192.168.0.230 (slave) (power value 1)
    Level INFO 09/22/2011 05:44:42 Config Load: MINSUPPLIES set to 1
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYCMD set to c:\Program Files\WinNUT\alertPopup.exe
    Level INFO 09/22/2011 05:44:42 Config Load: POLLFREQ set to 5
    Level INFO 09/22/2011 05:44:42 Config Load: POLLFREQALERT set to 5
    Level INFO 09/22/2011 05:44:42 Config Load: HOSTSYNC set to 15
    Level INFO 09/22/2011 05:44:42 Config Load: DEADTIME set to 15
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYMSG set to ONLINE : UPS %s is getting line power
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYMSG set to ONBATT : Someone pulled the plug on %s
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYMSG set to LOWBATT : UPS has a low battery
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYMSG set to SHUTDOWN : The system is being shutdown
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYFLAG set to ONLINE : EXEC
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYFLAG set to ONBATT : EXEC
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYFLAG set to LOWBATT : EXEC
    Level INFO 09/22/2011 05:44:42 Config Load: NOTIFYFLAG set to SHUTDOWN : EXEC
    Level INFO 09/22/2011 05:44:42 Config Load: RBWARNTIME set to 43200
    Level INFO 09/22/2011 05:44:42 Config Load: NOCOMMWARNTIME set to 300
    Level INFO 09/22/2011 05:44:42 Config Load: FINALDELAY set to 5

    And nothing else. So I don't see anything about things being polled correctly anywhere...

    Anyone can set me straight?
  • So I wanted to add that I've managed to get 2 readyNas units to automatically power down as well as my Windows7 PC. Here's what I did:

    Firstly my system is configured thus:
    ReadyNas Duo: 192.168.1.8
    ReadyNAS Ultra 2: 192.168.1.11 <- UPS is plugged into this NAS via USB.

    1) Intalled WinNut 2.0.4 on my PC and did exactly as the forum members here suggested (however I chose to run it as a service [there's a checkbox in the config tool]):

    I added the MONITOR line's:

    MONITOR UPS@192.168.1.11 1 pcuser mypassword slave

    Added NOTIFYMSG stuff:

    NOTIFYMSG ONLINE "UPS %s is getting line power"
    NOTIFYMSG ONBATT "Someone pulled the plug on %s"
    NOTIFYMSG LOWBATT "UPS has a low battery"
    NOTIFYMSG SHUTDOWN "The system is being shutdown"

    Added NOTIFYFLAG stuff:

    NOTIFYFLAG ONLINE EXEC
    NOTIFYFLAG ONBATT EXEC
    NOTIFYFLAG LOWBATT EXEC
    NOTIFYFLAG SHUTDOWN EXEC

    2) I then edited the scripts on my ReadyNas Duo.
    /etc/nut/ups.conf
    [UPS]
    driver = hidups
    port = /dev/usb/hiddev0

    /etc/nut/upsd.users
    [monuser]
    password = pass
    allowfrom = localhost
    upsmon master

    /etc/nut/upsd.conf
    ACL all 0.0.0.0/0
    ACL localhost 127.0.0.1/32

    ACCEPT monitor localhost
    ACCEPT monitor mynetwork
    REJECT all all

    3) I then edited the scripts on my ReadyNas Ultra2 (This is the NAS that has my UPS plugged into the USB port)
    /etc/nut/ups.conf
    [UPS]
    driver = hidups
    port = /dev/usb/hiddev0

    /etc/nut/upsd.users
    [monuser]
    password = pass
    allowfrom = localhost
    upsmon master
    [pcuser]
    password = mypassword
    allowfrom = mynetwork
    upsmon slave

    /etc/nut/upsd.conf
    ACL all 0.0.0.0/0
    ACL localhost 127.0.0.1/32
    ACL mynetwork 192.168.1.0/24

    ACCEPT monitor localhost mynetwork
    ACCEPT monitor mynetwork
    REJECT all all

    --------------------

    The information mynetwork should be replaced with your workgroup name and the password being your domain password. I'm not sure if I've got all the scripts correct. However it all works really well. Power down the AC outlet and my PC shuts itself down and then the NAS's shut down too when the UPS power goes into fail mode. I've set it to 40% threshold in the frontview web portal (as the snapshot shows at the beginning of this forum). BTW thanks for all the other's postings. Very useful stuff.
  • *EDIT*
    I found the answer to my own question. It appears that as of Windows Vista and Windows 7, Microsoft has stopped allowing interactive services. Interactive services is the ability for a service to interact with the desktop. That is why I was not getting popup alerts. I found the best solution was to add "Start WinNUT Ups Monitor" to the Startup folder. That way Winnut starts as an application on start up and popup notifications. If you don't care about popup notifications, then you can just install Winnut as a service.


    So I got WINNUT to work properly when running it as an application, but having issues when running it as a service. When running it as a service it appears that the pop up alerts stop working. I think Winut is actually working because if I veiw the logs after I disconnect the UPS, it shows that event. It's just that it no longer alerts me. Anyone have this issue and know of a fix?
  • can this also made working with a VMWARE ESXi server? Using a ESXi that is using a readynas pro6 as datastore. Aim would be to achive that the esx server shut's down first and afterwards the readynas.
    Any help appriciated
  • I know this is an ancient thread but google pointed me here and hopefully this can be helpful to others in the future.
    For OSX users I've made an AppleScript solution to avoid the hassle of installing package managers or build tools.

    I've posted more information here: http://www.readynas.com/forum/viewtopic.php?t=35314

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More