You are here
SMSR: monitoring the server room UPS
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.
NUT configuration
UPS to monitor | snmpsr |
---|---|
Hostname on which the UPS is located | smsrupsmon.inf.ed.ac.uk |
Port | 401/tcp (*) |
Username | smsr |
Password | smsr |
(* Note that 401/tcp
is not the standard port defined for NUT; that is 3493/tcp
. For historical reasons, the Informatics installation of NUT currently uses 401/tcp
. We intend to change our NUT installation at some stage, and will at that time move to the use of the standard port. When that happens, we will notify the managers of machines via the Self-managed server rooms mailing list.)
All of which leads to the following recommended upsmon.conf
file:
MONITOR snmpsr@smsrupsmon.inf.ed.ac.uk:401 1 smsr smsr 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:
- Edit
/etc/nut/nut.conf
to addMODE=netclient
as the final line. - Edit
/etc/nut/upsmon.conf
so that it contains the exact configuration suggested above. - 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 UPS: snmpsr@smsrupsmon.inf.ed.ac.uk:401 (slave) (power value 1) 0.000063 debug level is '2' 0.000000 Init SSL without certificate database 0.002534 Trying to connect to UPS [snmpsr@smsrupsmon.inf.ed.ac.uk:401] 0.220956 Logged into UPS snmpsr@smsrupsmon.inf.ed.ac.uk:401 0.220979 pollups: snmpsr@smsrupsmon.inf.ed.ac.uk:401 0.251920 parse_status: [OL] 5.252125 pollups: snmpsr@smsrupsmon.inf.ed.ac.uk:401 5.283040 parse_status: [OL] 10.283136 pollups: snmpsr@smsrupsmon.inf.ed.ac.uk:401 10.314110 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.