NUT is an UPS (UPS) monitoring system that allows the sharing of one (or more) UPS systems between several computers. It has a 'server' component, which monitors the UPS status and notifies a 'client' component when the UPS has a low battery. There can be multiple computers running the client component and each can be configured to shut down cleanly in a power failure (before the UPS batteries run out of charge).
There are two ways to monitor a UPS with NUT:
NUT is installed with the Pakfire web interface or via the console:
pakfire install nut
There is a detailed instructions here which cover additional options such as notifying other servers when a UPS is about to run out of power, email status notifications and more detail about the whole process.
This procedure is based on the official NUT user manual for an IPFire system connected to a single UPS with no other network-based clients. Although you can configure a UPS without testing, it is best that you prepare for a controlled outage of IPFire at the end of this procedure to test that your configuration works.
While nut can run entirely as root, it is best to run the "upsmon" monitoring process without root privileges. To do this we must create a new user and group.
useradd nutmon -g nut -s /sbin/nologinIdentify your UPS in the NUT Hardware Compatibility List and take a note of the Driver listed:
Connect to IPFire using ssh (or log in to the console) as "root"
cp /etc/nut/ups.conf.sample /etc/nut/ups.conf[eaton3s]
driver = usbhid-ups
port = auto
desc = "UPS"
upsd.conf sample file:cp /etc/nut/upsd.conf.sample /etc/nut/upsd.confLISTEN 127.0.0.1 3493cp /etc/nut/upsd.users.sample /etc/nut/upsd.userschown root:root upsd.conf upsd.userschmod 0640 upsd.conf upsd.users/usr/sbin/upsdrvctl startNetwork UPS Tools - UPS driver controller 2.7.2
Network UPS Tools - Generic HID driver 0.38 (2.7.2)
USB communication driver 0.32
Using subdriver: MGE HID 1.33
| Note! |
|---|
| If the previous command returns an error, saying that it cannot connect to a UPS, or it reports that the data is stale you must resolve the problem before continuing: either your ups.conf file is incorrect or you may have not chosen the correct driver for your UPS. |
chmod 0750 /var/state/ups/usr/sbin/upsdNetwork UPS Tools upsd 2.7.2
fopen /var/state/ups/upsd.pid: No such file or directory
listening on 127.0.0.1 port 3493
Connected to UPS [eaton3s]: usbhid-ups-eaton3s
| Note! |
|---|
| If there are any errors (except for the warning about the .pid file) they must be resolved before the rest of these instructions can be followed |
upsc <myupsname>@localhost ups.statusupsc <myupsname>@localhostupsc eaton3s@localhost ups.statusOL (Online) or OL CHRG (Online Charging)[admin]
password = "PLZset@strongpassw0rdh3r3!"
actions = SET
instcmds = ALL
/usr/sbin/upsd -c reloadcp /etc/nut/upsmon.conf.sample /etc/nut/upsmon.conf/etc/nut/upsmon.confPOWERDOWNFLAG /etc/killpower exists and is not commented out with a '#'MONITOR eaton3s@localhost 1 admin "PLZset@strongpassw0rdh3r3!" masterSHUTDOWNCMD "/sbin/shutdown -h +0"chown root:nut /etc/nut/*
chmod 640 /etc/nut/*
chown root:nut /var/state/ups
chmod 0770 /var/state/ups
/usr/sbin/upsmongrep upsmon /var/log/messages| Note! |
|---|
| 'upsmon' may display a confusing error "[ERR ACCESS-DENIED]" in the messages log. This may not indicate an actual failure. If this occurs, follow the instructions below. |
Login on UPS [your_ups@localhost] failed - got [ERR ACCESS-DENIED] stop upsmon and start it again with debug output enabled:for i in $( ps aux | grep [u]psmon | awk '{print $2}' ); do kill $i ; done
/usr/sbin/upsmon -DD
OL CHRGcp /etc/nut/nut.conf.sample /etc/nut/nut.confMODE=standalone/etc/init.d/nut startgrep ups /var/log/messages| Note! |
|---|
| You should now arrange a Change so that you can to test your configuration by shutting down IPFire on low battery. |
Before doing a test with low battery, you can verify that the NUT components are working by switching off the power to your UPS.
Broadcast message from nutmon@ipfire (Sat Aug 22 15:43:55 2015):
UPS eaton3s@localhost on battery'grep upsmon /var/log/messagesAug 22 15:43:55 ipfire upsmon[7532]: UPS eaton3s@localhost on batteryBroadcast message from nutmon@ipfire (Sat Aug 22 15:45:31 2015):
UPS eaton3s@localhost on line powergrep upsmon /var/log/messagesAug 22 15:45:45 ipfire upsmon[7532]: UPS eaton3s@localhost on line power