Got a couple of machines sharing a UPS? In today's How-To, we'll show you how to use your network to shut down all of the computers plugged into it and keep your precious data safe.
Edit /etc/default/nut with your favorite editor (example: sudo vi /etc/default/nut). Change the options to match above (i.e. no to yes).
Create and edit /etc/nut/ups.conf - (sudo vi /etc/nut/ups.conf)
The configuration is pretty simple. The compatibility list is a good place to start. Check the compatibility list to find out what driver/upstype to specify. For our APC BackUPS, it just the generic UPS driver, and we used serial port ttyS0.
It should look like this:
Once that's configured, you can run upsdrvctl start to see if your UPS driver is working.
We had to do a quick chmod 777 /dev/ttyS0 command to get things going. If you have two serial ports, you may need to try using /dev/ttyS1 instead.
Create and edit /etc/nut/upsd.conf. (sudo vi /etc/nut/upsd.conf)
Our remote Windows box is located at ip address 10.0.0.57, change it to suit.
If you want to allow your local network, put in the network address (i.e. 10.0.0.0/24)
ACL all 0.0.0.0/0
ACL remote 10.0.0.57/32
ACL localhost 127.0.0.1/32
Create /etc/nut/upsd.users. Put the following:
password = USERPASS
allowfrom = local
Create /etc/nut/upsmon.conf, add the following:
MONITOR ups-a-name-o@localhost 1 monuser USERPASS master
SHUTDOWNCMD "/sbin/shutdown -h +0"
replace MASTERPASS with your master password.
Click the Edit button next to the configuration file path.
In the first blank line, add the following
MONITOR email@example.com 1 upsmon USERPASS slave
deskups is the name of the UPS.
10.0.0.10 is the ip address of our Linux box.
The 1 says that 1 UPS must be running for the box to stay up.
USERPASS is the password from the upsd.users file.
slave tells the box to shut down ASAP so the master can shutdown first.
Save the file and close notepad.
Go back to the configuration tool and hit Apply and start WinNUT.
If you have a pair of Windows boxes you'd like to do this with, that's tough. Ok, we do have a few tricks: we've had good luck connecting GPS units up to multiple hosts serial ports just by wiring the ports together. You might be able to do a similar hack, but we haven't tested that one. So don't come crying to us if you break it.
Otherwise, that should be that. Let the rolling brownouts and blackouts begin!