Power to the Informatics Forum self-managed server rooms IF-B.Z14 and IF-B.01 is supplied by the same 200kVA Uninterruptible Power Supply (UPS) system as supplies the main Forum server server room IF-B.02.

We provide the facility for any self-managed machine to monitor the UPS, and to automatically shut itself down in the case that mains power has been lost for an extended period, and the UPS is signalling a 'low battery' condition. To use this facility, it is necessary that the Network UPS Tools (NUT) software is installed on the machine, and configured appropriately. It is recommended to install NUT via a package manager, if possible.

NUT configuration

UPS to monitor snmpsr
Hostname on which the UPS is located upsmonif
Username smsr
Password ZOAhn7ZP2pBK90u9KDyL

All of which leads to the following recommended upsmon.conf file:

MONITOR snmpsr@upsmonif 1 smsr ZOAhn7ZP2pBK90u9KDyL slave
SHUTDOWNCMD "/sbin/shutdown -h +0 \"UPS low battery\""
NOTIFYFLAG ONLINE SYSLOG
NOTIFYFLAG ONBATT SYSLOG
NOTIFYFLAG LOWBATT SYSLOG+WALL
NOTIFYFLAG FSD SYSLOG+WALL
NOTIFYFLAG COMMOK SYSLOG
NOTIFYFLAG COMMBAD SYSLOG
NOTIFYFLAG SHUTDOWN SYSLOG
NOTIFYFLAG NOCOMM SYSLOG

Specific instructions for servers running Ubuntu

Install NUT

Open a terminal window and type:

sudo su -
apt-get install nut-client

Configure NUT

sudo su -
cd /etc/nut
cp nut.conf nut.conf-dist
cp upsmon.conf upsmon.conf-dist

Now, still as the root user:

  1. Edit /etc/nut/nut.conf to add MODE=netclient as the final line.
  2. Edit /etc/nut/upsmon.conf so that it contains the exact configuration suggested above.
  3. Restart the NUT monitor by typing systemctl restart nut-client

Testing

To test your NUT configuration, you need first to stop the active NUT client, and manually run the NUT monitor daemon in debug mode:

sudo su -
systemctl stop nut-client
/sbin/upsmon -DD

You should see output similar to the following:

Network UPS Tools upsmon 2.7.2
kill: No such process
   0.000000	Using power down flag file /etc/killpower
   0.000638	UPS: snmpsr@upsmonif (slave) (power value 1)
   0.000737	debug level is '2'
   0.000000	Init SSL without certificate database
   0.072571	Trying to connect to UPS [snmpsr@upsmonif]
   0.080628	Logged into UPS snmpsr@upsmonif
   0.080641	pollups: snmpsr@upsmonif
   0.081279	parse_status: [OL]
   5.081549	pollups: snmpsr@upsmonif
   5.083128	parse_status: [OL]
  ...

If you do see similar output, your NUT installation and configuration is correct. At this stage, stop the NUT monitor debug daemon, and restart the NUT client in its usual mode:

  Ctrl-C
  systemctl restart nut-client

As a final check, type systemctl status nut-client and check the output for any warnings or errors. If none are present, the NUT UPS monitor is successfully installed and running, it is correctly monitoring the server room UPS, and it will be automatically restarted at any subsequent system reboot.

Last reviewed: 
20/08/2024