How To Configure NUT
How To Configure NUT
This How-To explains the steps involved in setting up a Dell or Penguin computer system
with Red Hat Linux v7.3 for use with the APC BackUPS Pro 280VA uninterruptible power
supply (UPS) and Network UPS Tools (NUT) software. The document is divided into 7
sections:
1. Requirements
2. Hardware Configuration
3. Software, Part 1 (installation and configuration)
4. OS Configuration
5. Software, Part 2 (configuration)
6. Testing
7. Troubleshooting
1. Requirements:
Note that the version of NUT listed here is has been tested and found to work with
RedHat v7.3. It has not been tested on older systems so compatibility is uncertain.
New and/or beta versions of NUT are available for download at:
http://www.exploits.org/nut
2. Hardware Configuration
Make available one COM port and connect the UPS using the APC UPS cable with part
number 940-0095B. The cable should have been supplied with the UPS unit. Otherwise
request one from APC and they will send it out free of charge.
Turn the computer on and enter the bios settings display. Shortly after you power on the
computer system you should see a brief message showing how to do this. Usually,
depressing the F2 or Delete key during the boot process will get you there.
Once in, look for power settings and ensure that the following requirement is met:
1
3. Software Installation and Configuration, Part 1 (install)
Log in as root.
Obtain the following nut rpm files from the UNAVCO software download site:
1. nut-client-0.45.4-1.i386.rpm
2. nut-0.45.4-1.i386.rpm
3. nut-cgi-0.45.4-1.i386.rpm
Note that there are other files that are not listed here that should have been installed. They
are drivers for other UPSs and utilities for functions which will not be used. Some files
listed above that are greyed out will not used as well.
2
4. OS Configuration
/etc/rc.d/init.d/halt
Explanation:
The statements listed above translate to the following:
1. if a ‘halt’ command has been issued
2. check to see if the upsmon, killpower, and ups files exist
3. if they do exist, source the /etc/sysconfig/ups file (the variables that are assigned within
that file are exported to the shell environment.
4. if the group of variables listed in the square brackets meet the conditions stated within
then execute $MODEL -a $DEVICE -k
The last command tells the UPS to shut down. This is the last statement that is
executed after the OS itself has sucessfully unmounted the filesystems.
3
5. Software Installation and Configuration, Part 2 (configuration)
A. Edit file:
/etc/rc.d/init.d/ups
else
Explanation:
The -p flag tells upsmon to run in privileged mode always. In other words, all child
processes of upsmon will inheret root privileges from the upsmon parent process.
When upsmon (owned by root) is run it will spawn one child process which is owned
by the user nobody.
SERVER=yes
MODEL=apcsmart
DEVICE=myups
OPTIONS=”-a”
Explanation:
SERVER: The UPS is connected to the same machine that NUT is controlling
MODEL: The name of the device driver for the type of UPS being used
DEVICE: The name assigned to the UPS. It may be arbitrary but it must be
consistent across all configuration files where applicable.
OPTIONS: Arguments passed to the device driver (MODEL). -a flag tells the
driver to read the /etc/ups/ups.conf configuration file which
contains information on where and how the UPS is connected.
4
C. Edit file /etc/ups/ups.conf
[myups]
driver=apcsmart
port=/dev/ttySn
cable=940-0095B
Explanation:
[myups]: The name assigned to the UPS. It may be arbitrary but it must be
consistent across all configuration files where applicable. Must be
placed within [].
driver: The name of the device driver for the type of UPS being used
port: The port to which the UPS is connected (e.g., /dev/ttyS1)
cable: The APC cable with part number 940-0095B. This cable is
required. Although others may work they have not been tested.
The cable type must be specified since the default configuration
assumes a different cable.
Explanation:
ACL: Access Control List. Lists the hosts that may access the server.
ACCESS: What level of access to grant, to whom, and what password to
use.
5
E. Edit file /etc/ups/upsmon.conf
Explanation:
6
F. Edit file /etc/ups/upssched.conf
Explanation:
CMDSCRIPT: The script or executable that will perform the actions specified in
this and any other related configuration file
(e.g., /usr/sbin/upssched-cmd).
AT ONBATT/: Do action specified when certain condition exists. E.g., when on
ONLINE battery, start the shutdown timer. When back online, cancel the
shutdown timer.
Explanation:
This script is executed during the final stage of system shutdown when the read-only
filesystems are remounted. A command is issued to the UPS instructing it to turn off.
The computer system and UPS will remain on for about twenty seconds after this
command is sent.
7
H. Remaining Items…
Be sure that ownership/group and permissions for each file is set correctly. They
should be as follows:
-rw------- 1 root root 747 Feb 26 2002 hosts.conf
-rw------- 1 root root 2174 Feb 26 2002 multimon.conf
-rw------- 1 root root 441 Sep 27 15:02 ups.conf
-rw------- 1 root root 465 Sep 27 15:02 upsd.conf
-rw------- 1 root root 2179 Feb 26 2002 upsd.users
-rw------- 1 root root 791 Sep 27 15:02 upsmon.conf
-rw------- 1 root root 535 Sep 27 15:02 upssched.conf
-rw------- 1 root root 1420 Feb 26 2002 upsset.conf
-rwxr-xr-x 1 root root 1656 Sep 27 15:02 /etc/init.d/ups
-rwxr-xr-x 1 root root 19331 Feb 26 2002 /usr/sbin/upssched
-rwxr-xr-x 1 root root 602 Sep 27 15:02 /usr/sbin/upssched-cmd
-rw-r--r-- 1 root root 412 Sep 27 15:02 /etc/sysconfig/ups
-rwxr-xr-x 1 root root 5098 Sep 27 15:02 /etc/init.d/halt
Add the new UPS service and activate it in runlevels 3, 4, and 5 by issuing the following
commands:
6. Testing
Simulate a power failure to test the machine. Perform the following three tests to confirm
a properly working system:
i) disconnect power, wait for full shutdown (inverter kill), restore power
ii) disconnect power during bootup, wait for full shutdown, restore power
iii) disconnect power, wait for shutdown process to begin, then restore power during shutdown process
The computer should recover from all these circumstances. Keep in mind the time delays
you have set. Impatience may bring about the appearance of a system not working
properly. Just wait and see what happens keeping in mind the time delay you set. For the
purpose of expediency you may want to temporarily set the shutdown timer to 30 seconds
(or less), for example. Just remember to change them back after confirming positive test
results. If the system does not appear to be functioning as you would expect, refer to the
troubleshooting section of this document.
8
7. Troubleshooting
Problem Remark
1. NUT does not appear to install a. Check that the version of rpm file was
properly or won’t install. created for NUT matches rpm installed on
the OS.
2. driver does not appear to be a. Make sure you’re using the correct UPS
communicating with the UPS serial cable (940-0095B).
b. Did you choose the right UPS driver?
c. Is there a port conflict? Make sure the
port is available for use.
d. Is the UPS plugged into the port?
3. Computer won’t shut down after a. Did you reboot machine after installing
disconnecting utility power. the software?
b. Refer to Remarks for Problem #2
4. Computer powers down completely Remove the -p option from the
after disconnecting utility power. Does HALTARGS=”HALTARGS -p” line in
not reboot automatically after restoring /etc/rc.d/init.d/halt file.
utility power. Must manually turn it back
on.
5. Computer remains on after cutting Did you plug the computer into the UPS in
utility power to the UPS and the UPS the first place???
inverter shuts down.
6. The OS is halted (proper shutdown) Make sure the bios power settings are set
and the inverter shuts off after utility so that the computer is on after a power
power disconnect but after restoring the failure recovery.
utility power the UPS turns back on but
the computer doesn’t.
7. If all else fails… Contact Jay Sklar via [email protected]