UPS setup with multiple computers


Recommended Posts

Just getting my hands dirty with unRAID and finally have a basic system up and running for a few days now.

 

One concern I had was regarding automatically shutting down unRAID during a power failure.  I have a 1KVA APC UPS right now with the monitoring cable plugged into my iMac.  What's the easiest way to have my unRAID server realize when on battery?

 

My first thought was to configure a script on my Mac to send an SSH command to unRAID to tell it to shutdown.  I'm still learning where all of the resources are to various things, so forgive me if I overlooked a document that already spells this out.

 

I'm a 20 year UNIX SA, so hoping to contribute some Linux expertise to this project as well.

Link to comment

The APX UPS package available for UnRAID requires direct communications with the UPS.

 

With your Unix knowledge, you may be able to rewrite that script to accept a message from your Apple ... or perhaps do it in reverse => connect the UPS comm to UnRAID and send a message to the Apple.

 

Personally, I'd just buy a separate UPS unit for the UnRAID box  :)

[e.g. http://www.newegg.com/Product/Product.aspx?Item=N82E16842101381 ]

 

Link to comment

I may end up doing that--separate UPS.  I've been moving away from APC due to some failures over the years and using CyberPower (not sure where I got Powerware from in my original post there).  Does the UPS daemon/pkg only work with APC brand units or more of a generic package?

 

Then, again, I could just get a new UPS for the iMac (CyberPower) and move the APC to the unRAID server.

Link to comment

APCUPSD does NOT need direct connection to the UPS.

It does listen on the LAN for power failure messages on port  from another instance of "apcupsd" that is directly connected to a UPS.

Many people have done this. 

 

quoting from the apcupsd.conf file, ther are several network protocls supported

# To get apcupsd to work, in addition to defining the cable

# above, you must also define a UPSTYPE, which corresponds to

# the type of UPS you have (see the Description for more details).

# You must also specify a DEVICE, sometimes referred to as a port.

# For USB UPSes, please leave the DEVICE directive blank. For

# other UPS types, you must specify an appropriate port or address.

#

# UPSTYPE  DEVICE          Description

# apcsmart  /dev/tty**      Newer serial character device,

#                            appropriate for SmartUPS models using

#                            a serial cable (not USB).

#

# usb      <BLANK>          Most new UPSes are USB. A blank DEVICE

#                            setting enables autodetection, which is

#                            the best choice for most installations.

#

# net      hostname:port    Network link to a master apcupsd

#                            through apcupsd's Network Information

#                            Server. This is used if you don't have

#                            a UPS directly connected to your computer.

#

# snmp      hostname:port:vendor:community

#                            SNMP Network link to an SNMP-enabled

#                            UPS device. Vendor is the MIB used by

#                            the UPS device: can be "APC", "APC_NOTRAP"

#                            or "RFC" where APC is the powernet MIB,

#                            "APC_NOTRAP" is powernet with SNMP trap

#                            catching disabled, and RFC is the IETF's

#                            rfc1628 UPS-MIB. You usually want "APC".

#                            Port is usually 161. Community is usually

#                            "private".

#

# dumb      /dev/tty**      Old serial character device for use

#                            with simple-signaling UPSes.

#

# pcnet    ipaddr:username:passphrase

#                            PowerChute Network Shutdown protocol

#                            which can be used as an alternative to SNMP

#                            with AP9617 family of smart slot cards.

#                            ipaddr is the IP address of the UPS mgmt

#                            card. username and passphrase are the

#                            credentials for which the card has been

#                            configured.

 

Unless you configure it otherwise, the network service port is defined on port 3551:

#

# ==== Configuration statements for Network Information Server ====

#

 

# NETSERVER [ on | off ] on enables, off disables the network

#  information server. If netstatus is on, a network information

#  server process will be started for serving the STATUS and

#  EVENT data over the network (used by CGI programs).

NETSERVER on

 

# NISIP <dotted notation ip address>

#  IP address on which NIS server will listen for incoming connections.

#  This is useful if your server is multi-homed (has more than one

#  network interface and IP address). Default value is 0.0.0.0 which

#  means any incoming request will be serviced. Alternatively, you can

#  configure this setting to any specific IP address of your server and

#  NIS will listen for connections only on that interface. Use the

#  loopback address (127.0.0.1) to accept connections only from the

#  local machine.

NISIP 0.0.0.0

 

# NISPORT <port> default is 3551 as registered with the IANA

#  port to use for sending STATUS and EVENTS data over the network.

#  It is not used unless NETSERVER is on. If you change this port,

#  you will need to change the corresponding value in the cgi directory

#  and rebuild the cgi programs.

NISPORT 3551

 

Joe L.

Link to comment

I may end up doing that--separate UPS.  I've been moving away from APC due to some failures over the years and using CyberPower (not sure where I got Powerware from in my original post there).  Does the UPS daemon/pkg only work with APC brand units or more of a generic package?

 

Then, again, I could just get a new UPS for the iMac (CyberPower) and move the APC to the unRAID server.

 

If you think you might go unRaid on ESXi, here is a link regarding a CyberPower VM Appliance that handles clean shutdowns of the VMs and Esxi that is very nice and easy to setup/configure.  http://lime-technology.com/forum/index.php?topic=25415.msg250388#msg250388

Link to comment

APCUPSD does NOT need direct connection to the UPS.

It does listen on the LAN for power failure messages on port  from another instance of "apcupsd" that is directly connected to a UPS.

 

Correct.  I have my unRAID server as the system monitoring the UPS since it is powered all of the time.  Then my second server (which is only occasionally powered up) has APCUPSD configured as a Slave connection and pointing to the main unRAID box.  It is perfectly possible to set up multiple slaves as well.

 

In the OP's case, unless the Mac is powered more of the time than the server, it might make sense to set up unRAID as the master and then have the Mac configured as the slave.

 

 

Link to comment

APCUPSD does NOT need direct connection to the UPS.

It does listen on the LAN for power failure messages on port  from another instance of "apcupsd" that is directly connected to a UPS.

Many people have done this.

Just be VERY sure that you think through all the timing issues when chaining one to another. If your ethernet switch isn't on battery backup, your messages won't get through. If your master machine shuts down too quickly, your slave machines won't shut down. The way I handle it is a successively longer set of shutdown times specified in the apcupsd config, so all the slave machines should have shut down well before the master runs out of battery.
Link to comment

Oh, yeah, I would make sure the unRAID was the last thing to be shutdown.  At home I typically don't let any of my systems run for more than 5 minutes on UPS power.  If the power is not back by then, then it won't be back for hours.  Switch is on the same UPS too.

 

The next complication is sorting out how apsupsd would run on the iMac.  It already has built-in communication tools for UPS's, so I don't know how that would work together (in other words, I don't know how the Mac could be a master or slave at this point).  I thought I could configure my Mac to send a command, but looking through the power management tools, but I'm not seeing that.

 

Separate UPS is looking like a more likely solution especially as disk needs grow.  I need to revaluate my UPS's at home and sort things out.

Link to comment

Found something even better:  /usr/libexec/upsshutdown

 

It's a built in OS shell script where you can list commands to be execute before a shutdown is sent to the OS.  There's even a man page for it.  So, I'll arrange for a script to be called that will also include an additional delay to allow the Mac to shutdown before unRAID shuts down.

Link to comment

Yes, I can confirm that you can run apcupsd on OSX. It even adds a menu bar I on that gives you info on the UPS connected to the master machine (my unraid box) such as battery charge, load and run time.

 

And for anyone else looking at this thread... Your switch is now critical equipment and must be on the ups. Didn't think that one through until my iMac ran the ups dry after unraid shut-down during an outage :(

Link to comment

Switches, router, and cable or dsl modem are all good things to have on your UPS.  They draw VERY little power, but are clearly necessary for your network (switches & router) or internet access (most cable/phone companies have their own power protection, so you can likely still use the internet if the modem is powered).    While the latter isn't particularly useful for UnRAID, it's nice if you're on a PC and sending an e-mail, finishing up a download, etc. when an outage occurs.

 

Link to comment
  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.