User:DanilKutkevich/Draft of NUT

About
The Network UPS Tools (NUT) provide monitoring of UPS and PDU hardware and ensure safe shutdowns of the systems which are connected.

For more information about it, you can check NUT homepage.

Introduction
I bought a Powerware 5115 UPS and wanted my computer to speak with it. NUT can speak with quite many UPS, so this howto isn't just for the Powerware 5115, although the examples in it will be for it, but it won't be difficult to merge it to your hardware. Start with surfing to the NUT's compatibility section. Is your UPS supported? If it isn't, look for a model that is in the same series. With good luck it can work, but that isn't for sure. When you find your UPS in the list, check what driver works with it, and write it down for later use.

Installation
Now emerge NUT using:

Configuration
Open in an editor. Add to this file every UPS you want to monitor. Mine looks like this:

Change the values to something that fit's your configuration better and save. Here you can find a list of supported UPS and the according drivers. If you have a USB connection to your UPS, you should build with. Your entry might look like:

for Mustek:

upsd
Open. This file contains access-policy to the UPS's you have.

To only allow the same computer to connect to them, the file should look like this:

The ACL-lines are used to add hosts. The syntax is ACL name IP. If the name is placed after ACCEPT connections from there are accepted, if it's placed under REJECT, connections are rejected.

Users
Next open. This file contains accounts for users who want's to play with the UPS:es. The following line grants acces to the user server to everything.

upsmon
Next take a look at. This is the UPS Monitors configuration. Read through it. There isn't much to read, and it is easy understood. This is the only section where you have think a bit... Be sure to create a MONITOR rule.

upssched
Have a look att too, there might be something you want.

Port Ownership
If you are using RS-232 serial port to communicate with your UPS, you should run the following (so that your nut user will have access to ). Newer portage installs already have this done, but it won't hurt to run again:

If you are using USB port ("auto" setting) to communicate with your UPS, you should run:

Finishing
Now, start the services:

And add them to the default runlevel:

If you didn't get any error when you started the services you seemed to configure it right. Else, have a look at the error output and think what might be wrong. One error I got was the permissions of the serialport, which is easy fixed with adding nut to the tty-group. A similar error for usb-connected UPSs can be fixed by adding nut to the plugdev group.

Testing
Test upsc and see if your UPS replies:

If you get "OL" (On Line) everything is working good (if it is on the line and not battery).

To see every command your UPS supports, type: