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:
Note! |
---|
There are also 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. |
Note! |
---|
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. |
Note! |
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/nologin
Identify 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"
cp /etc/nut/upsd.conf.sample /etc/nut/upsd.conf
LISTEN 127.0.0.1 3493
cp /etc/nut/upsd.users.sample /etc/nut/upsd.users
chown root:root upsd.conf upsd.users
chmod 0640 upsd.conf upsd.users
/usr/sbin/upsdrvctl start
Network 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/upsd
Network 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.status
upsc <myupsname>@localhost
upsc eaton3s@localhost ups.status
OL
(Online) or OL CHRG
(Online Charging)[admin] password = "PLZset@strongpassw0rdh3r3!" actions = SET instcmds = ALL
/usr/sbin/upsd -c reload
cp /etc/nut/upsmon.conf.sample /etc/nut/upsmon.conf
/etc/nut/upsmon.conf
POWERDOWNFLAG /etc/killpower
exists and is not commented out with a '#'MONITOR eaton3s@localhost 1 admin "PLZset@strongpassw0rdh3r3!" master
SHUTDOWNCMD "/sbin/shutdown -h +0"
chown root:nut /etc/nut/* chmod 640 /etc/nut/*
chown root:nut /var/state/ups chmod 0770 /var/state/ups
* chown root:nut /etc/nut/upsmon.conf * chmod 640 /etc/nut/upsmon.conf
/usr/sbin/upsmon
grep 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:kill
ps aux | grep [u]psmon | awk '{print $2}'*
/usr/sbin/upsmon -DDOL CHRG
cp /etc/nut/nut.conf.sample /etc/nut/nut.conf
MODE=standalone
/etc/init.d/nut start
grep 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/messages
Aug 22 15:43:55 ipfire upsmon[7532]: UPS eaton3s@localhost on battery
Broadcast message from nutmon@ipfire (Sat Aug 22 15:45:31 2015):
UPS eaton3s@localhost on line power
grep upsmon /var/log/messages
Aug 22 15:45:45 ipfire upsmon[7532]: UPS eaton3s@localhost on line power
Older Revisions • December 23 at 3:48 pm • Christopher Suttles