« Prospect give out members details to an unknow person by emailHOWTO: setup a pxe server on Fedora with dnsmasq »

HOWTO: Setup and install NUT to work with Fedora

20/07/11

HOWTO: Setup and install NUT to work with Fedora

The only reason I'm using NUT rather than apcupsd is that my ReadyNas Duo will not talk to apcupsd. apcupsd is a lot simpler to setup and install without a lot of duplication of configuration values.

sudo yum install nut nut-client nut-cgi

We need to edit a whole bunch of config files most are in /etc/ups. But first we will start with

sudo nano /etc/sysconfig/ups
MODE=netserver
SERVER=yes

Tell nut we will be a server over the network.The same message needs to also be in the nut.conf. You will see this type of annoying duplication of configuration a lot with nut ( think I already mentioned that though).

Setup which UPS's we are going to be monitoring from this machine, in our case its the one actually connected to this machine.

sudo nano /etc/ups/hosts.conf
MONITOR UPS@localhost "UPS on Mailserver"

Tell Nut we will be a netserver again.

sudo nano /etc/ups/nut.conf
MODE=netserver

Create the setting for the UPS we will be monitoring, I'm using an APC Back-UPS BR 800 connected via its USB cable. If you want this to be able to talk to a ReadyNas you MUST call it [UPS]. (ReadyNas Duo another product I have and would not recommend. Among other things it is painfully slow even with the extra RAM module.)

sudo nano /etc/ups/ups.conf
[UPS]
    driver = usbhid-ups
    port = auto
    desc = "UPS on Mailserver"
sudo nano /etc/ups/upsd.conf
LISTEN 192.168.0.11 3493

set the user that will be connecting in to get the status of the UPS. This one is local.

sudo nano /etc/ups/upsd.users
[upsuser]
    password = PASSWORD_HERE
    upsmon master
sudo nano /etc/ups/upsmon.conf
MONITOR UPS@mailserver 1 upsuser PASSWORD_HERE master
sudo chkconfig ups --list
sudo chkconfig ups on
sudo service ups restart

It is possible to check the drive is starting up cleanly, If it does not make sure you are using the correct driver for your hardware and that all the options are set correctly.

sudo upsdrvctl start

With my APC ups I see the following:

Network UPS Tools - UPS driver controller 2.6.1
Network UPS Tools - Generic HID driver 0.35 (2.6.1)
USB communication driver 0.31
Using subdriver: APC HID 0.95

Check that data is being returned correctly and providing a good status.

upsc ups@localhost ups.status
OL
  • OL - on line power
  • OB - on battery
  • LB - low battery

To check that all is running look at the verbose output from this command, which is a list of all the settings for your ups.

upsc ups@mailserver

Where ups is the [name] from ups.conf and appears to be case insensitive for this command.

I also had to hack :> /etc/init.d/halt to stop the system going down completely. This was necessary to allow the system to come back up automatically after the power is restored.

sudo nano /etc/init.d/halt
HALTARGS="-d"
[ "$INIT_HALT" != "HALT" ] && HALTARGS="$HALTARGS -p"
sleep 120
exec $command $HALTARGS

Test the whole thing is working by removing the power core from the UPS wait fort he message to say the UPS is on battery power and then run this command

sudo upsmon -c fsd

If all is well the system should close down to the system has halted output and stay powered up. The UPS will then cut power to the system. When you put the power cord back in the UPS it will pop and squeak a bit and the lights should flash. After a short delay evertything will power backup again.

Pages: 1· 2

No feedback yet

Here are a collection of Mini-HOWTOs some of which are too short even for that grand title. I keep them around as it is easier to remember where to look these up that to remember the content of the mini-HOWTO

Search

Contents

multiple blogs