Again it’s been a loooong time since I’ve posted anything. Here’s a guide to how I got my Powershield Defender 1200 up and running using NUT under Debian. This is a cheap and lightweight (software wise, UPSes weigh a ton) solution for power protection of a home or small business server.
This part is dead simple, the NUT packages are already in the Debian repos so:
sudo apt-get install nut
This will install all NUT components and it’s dependencies. It does most of the hardwork for you, you just need to modify configuration files to your needs.
Modifying configuration files:
There are several configuration files that need to be modified in order to get a functional install; nut.conf, ups.conf, upsd.users and upsmon.conf. You can use the locate command that’s pre-installed on most systems to find them, the following is from my Debian box but your paths may be different:
$ locate nut.conf ups.conf upsmon.conf upsd.users
Use the text editor of your choice to open and modify the configuration files, I use nano. The nut.conf file is a dead simple modification just to set how the UPS is connected, I’m only using it directly connected so I added “MODE=standalone” to the end of the nut.conf file (ensure it’s not commented out with a “#” at the start of the line). Other modes are described in the conf file but most would use the same as me. You then need to add a definition for the UPS and it’s driver to ups.conf, mine is the below:
[defender1200] #A name to refer to your UPS, you can put whatever you like here but something descriptive and easy to type will make it easier to run commands
driver = blazer_usb #USB driver module compatible with Powershield Defender series UPS
port = auto #Typical setting for USB based UPS
desc = “homeserver” #A description for your own reference, is not critical and can be set to whatever you like
You then need to add a user for the upsmon daemon to access the UPS, this is done in upsd.users, I added the following at the end of the file:
[upsmon] #username of your choice
password = enterpasswordhere #substitute your own desired password, this does not have to match a system user
upsmon master #not sure whether “upsmon” on this line is because it’s the user or to give special permission to the upsmon daemon, this is what I was able to scrape together into a working config, master is what you’ll select if upsmon is monitoring a locally connected UPS rather than one on a remote machine
The final config file is a bit more complex than the previous two, it sets parameters for the upsmon daemon that handles the monitoring of the UPS and triggers system commands for low battery signals etc. For a basic setup though you should only need to add one line and modify another. First you’ll need to add a line defining the user to use for upsmon:
MONITOR defender1200@localhost 1 upsmon $UPSD3fender master #this is my example user setup defined in the following format
MONITOR [UPS_name]@[hostname] [powervalue] [username] [password] [master or slave]
UPS_name is the name you’ve configured in ups.conf for the UPS, hostname is the network address of the machine it’s connected to usually just “localhost”, [powervalue] is the number of powersupplies on the system, usually just “1″, username and password are those you’ve configured in upsd.users and master or slave is the method you’re connecting to the UPS by, usually master.
After all this, as root (or sudo) run:
$ sudo /etc/init.d/nut start
Starting Network UPS Tools: driver(s) upsd upsmon.
If you’re lucky you’ll get the above output and you’re ready to go! You can check the UPS stats using the following, where defender1200 is the name you’ve given the UPS:
$ upsc defender1200
ups.type: offline / line interactive
Hopefully this makes the process more clear for anyone in the same situation as I found it difficult getting some aspects of the config just right and had to trawl around quite a few man pages. The configuration provided here will automatically start a shutdown when the UPS sets a low battery signal, if you configure your machine to automatically power back on after a power failure it will also restore itself once power is restored.