General UPS questions

Discussion in 'Off-topic' started by Bohs Hansen, Jul 5, 2011.

  1. Offline

    Bohs Hansen Guest

    Member Since:
    Bohs Hansen, Jul 5, 2011

    Hi all

    It's about time that I invest in a UPS, special since my FreeNAS server is going to use ZFS. I've never previous owned one, so I got a couple questions about it.

    I got 3 servers running (2 Qnap ARM and my FreeNAS box), all low-power consuming devices, so I'm hoping one semi powerful UPS will do the trick, however I'm confused about the connectivity.

    They either use a serial port or USB for control, but I can only attach this to one system (i think), even though they all come with multiple outlets for multiple devices.
    A couple come with LAN ports (and cost a lot more), but as far as i could read, that is just for surge protection.... and if power goes, so does the switch.

    Is there any way I can have it shut down all my 3 servers, or do I have to invest in 3 UPS? I don't need it to run them without power, but just to shut them down if the powercut lasts longer then 5secs.
  2. Offline

    ohnename Super Moderator

    Member Since:
    May 26, 2011
    Messages:
    88
    Message Count:
    88
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Germany & France
    ohnename, Jul 5, 2011

    I have RS232 and USB at my UPS (powerware 9120) but I can only use one of these ports at the same time for shutting down a box.
    Depending from your model, it is possible to add an Interface-Expander (2 ports, 8 ports ore more, mostly RS232) for shutting down all your PCs/NAS.
    You have 2 Qnap NAS (Low Power Consumption) and a FN box so maybe you can find a cheap UPS with the option to add a 2 port Interface-Expander, that should be enough for your config.
  3. Offline

    Bohs Hansen Guest

    Member Since:
    Bohs Hansen, Jul 5, 2011

    Thanks a lot ohnename, that gives me something to look for. Totally new area for me, and the information about it is limited (as they assume people just know this)
  4. Offline

    ProtoSD FreeNAS Guru

    Member Since:
    Jul 1, 2011
    Messages:
    3,358
    Message Count:
    3,358
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Jul 5, 2011

    If you're clever enough, you have the one system that is going to be shutdown send out commands to the other two. I'm sure this is possible, I'd just have to give it some thought. Maybe someone else has an idea.
  5. Offline

    ProtoSD FreeNAS Guru

    Member Since:
    Jul 1, 2011
    Messages:
    3,358
    Message Count:
    3,358
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Jul 5, 2011

  6. Offline

    Bohs Hansen Guest

    Member Since:
    Bohs Hansen, Jul 6, 2011

    sometimes the solution is so simple you can't see it - of course. And with all 3 systems drawing a total of around 230W at max load, I should get away relative cheap. But has to wait till next month .. spent all my spare money already (Actual did that on the 1st :p) for concert tickets for summer/fall this year :)

    thanks a bunch protosd.
  7. Offline

    Milhouse FreeNAS Aware

    Member Since:
    Jun 1, 2011
    Messages:
    555
    Message Count:
    555
    Likes Received:
    5
    Trophy Points:
    18
    Milhouse, Jul 6, 2011

    Bohs, you want to monitor your UPS over the network:

    http://www.networkupstools.org/

    Have the UPS connected to one server (USB or Serial), and this "master UPS" server then sends out the "shutdown" command over the network to all other "UPS slave" clients when the battery reaches a critical level (usually about 10% remaining). Obviously this means you need to have your network switch powered by the UPS as well as all the servers!

    FreeNAS 8 can (in theory) act as the "master" to allow remote network monitoring of the UPS by the slave/clients - I believe that's what the "Remote Monitor" checkbox is for in the UPS settings.

    Sadly, FreeNAS 8 cannot (yet?) act as a slave/client if the UPS is already connected to another remote server - without this capability UPS support in FreeNAS is still not usable for me. :(
  8. Offline

    ProtoSD FreeNAS Guru

    Member Since:
    Jul 1, 2011
    Messages:
    3,358
    Message Count:
    3,358
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Jul 6, 2011

    Milhouse-

    Good point about making sure your network switch is on the UPS Milhouse! I have mine setup like that but its something that can easily get missed and bite you.

    BTW, do I recognize you from over on the N800 forums? Haven't been on there for awhile.
  9. Offline

    Milhouse FreeNAS Aware

    Member Since:
    Jun 1, 2011
    Messages:
    555
    Message Count:
    555
    Likes Received:
    5
    Trophy Points:
    18
    Milhouse, Jul 6, 2011

    And of course, if you want to receive email notification of power loss then you'll also need your modem/gateway on the UPS too!

    Guilty as charged... now hanging out at www.meego.com - lots of interesting stuff happening there!
  10. Offline

    JimL

    Member Since:
    Sep 20, 2011
    Messages:
    11
    Message Count:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bodø, Norway, Norway
    JimL, Oct 28, 2011

    Any spesifics on how to actually run a command when freenas starts a ups forced shutdown? Running Freenas7

    I know I can add them to command scripts - shutdown, but would be better to run it on ups-shutdowns only.
  11. Offline

    Milhouse FreeNAS Aware

    Member Since:
    Jun 1, 2011
    Messages:
    555
    Message Count:
    555
    Likes Received:
    5
    Trophy Points:
    18
    Milhouse, Oct 29, 2011

    FreeNAS 7 - see link at the top of the forum. This site is for FreeNAS 8.

    If you were on FreeNAS 8, and since I'd already typed this out before noticing you were on FN7 I may as well let it stand... you'd need to hack a change into /etc/local/nut/upsmon.conf, replacing the default shutdown command with your own script (that would also end with a "shutdown -p now"). Though as this conf file is rewritten from the database, it would require modifying the script that creates upsmon.conf, which is /etc/rc.d/ix-ups (modify the /conf/base version to keep the change across boots).

    Perhaps as an enhancement you should open a ticket requesting that the default shutdown command can be changed via the GUI.

    The changes for FN7 are probably similar - find the post on the FN7 forum detailing how to get network UPS support working in FN7, and it should give you all the clues you need.
  12. Offline

    Gnome Newbie

    Member Since:
    Aug 18, 2011
    Messages:
    54
    Message Count:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Occupation:
    Software Engineer
    Location:
    Cape Town, South Africa
    Gnome, Nov 2, 2011

    I've got a UPS running with a Windows Server based computer managing the UPS.

    The UPS I've got is a APC Smart-UPS (SUA1500) which comes bundled with their own tool for Windows. That tool allows a shutdown script.

    The shutdown script I created for my FreeNAS box which I also use for Linux servers is as follows:

    I use Ps exec to run Plink (which is a commandline tool for PuTTy) to SSH into the box and execute a single command then return.

    It executes the shutdown now -p command on all the servers. In the BIOS of the servers I've set the: On AC Power Loss option to Power On. (eg. if the PSU loses power and comes back online, start up automatically).

    Before that I experimented with other options, I tried creating a Java application that could shutdown the server using the web-interface but it was unreliable. Same happened with PHP. FreeNAS 8 uses AJAX which significantly complicates the problem. You have to log in first then send the command to the web-application. You can catch the actual AJAX that it sends using FireBug.
  13. Offline

    Milhouse FreeNAS Aware

    Member Since:
    Jun 1, 2011
    Messages:
    555
    Message Count:
    555
    Likes Received:
    5
    Trophy Points:
    18
    Milhouse, Nov 2, 2011

    If you used WinNUT on the Windows server (aka master) you could connect the UPS to the FreeNAS server (as master) and run the Windows Server as the slave - just enable "Remote Monitoring" in the FreeNAS UPS config. No hacks or remote command execution required.

    NUT (Network UPS Tools) is designed to avoid just the kind of hacks you have employed. All servers on the network that support NUT monitoring would automatically shutdown once configured to monitor the network for UPS related events.
  14. Offline

    Gnome Newbie

    Member Since:
    Aug 18, 2011
    Messages:
    54
    Message Count:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Occupation:
    Software Engineer
    Location:
    Cape Town, South Africa
    Gnome, Nov 2, 2011

    Thanks :D I'll give it a try. So I can still run WinNUT on Windows? Reason being the FreeNAS system can't really have the UPS connected to it.

    Is it possible to run a UPS remotely in FreeNAS 8? I'm still on 7 but I'll be upgrading soon, however I don't see the remote option in the 7 GUI?
  15. Offline

    Milhouse FreeNAS Aware

    Member Since:
    Jun 1, 2011
    Messages:
    555
    Message Count:
    555
    Likes Received:
    5
    Trophy Points:
    18
    Milhouse, Nov 2, 2011

    According to the WinNUT page it is a partial port of NUT and supports network monitoring only (ie. slave mode), so it doesn't appear as though WinNUT will act as the master to monitor a locally connected UPS.

    However if you look at the NUT download page, there is a Windows MSI installer labelled as "complete port" in the binary packages section (released July 2011) that might be worth investigating.

Share This Page