As many folks following me on Twitter have noted, I’ve been building quite a nice vSphere “datacenter” lately. Part of this build was integrating UPS monitoring and automatic shutdown, and I’m pleased with the result. I’m using a Raspberry Pi connected to two UPSes via USB as a NUT server and have installed a native ESX version of upsmon to monitor and react as UPS events happen. Best of all, the whole install cost less than $50!

My Mini Datacenter
My mini datacenter is constructed from the following elements:
- Three Intel NUC servers
- 2x D54250WYKH (fourth generation i5)
- 1x NUC5i3MYHE (fifth generation i3)
- One TP-Link TL-SG2424 switch
- One Raspberry Pi (model 2B) connected to a Drobo
- An old Iomega ix4-200d
- A pair of UPSes
I’m aiming for low power, low noise, low cost, and maximum utility in this mini datacenter. It’s not a lab really, since I’m running pfSense “in production” to manage my Internet access. But it’s definitely not an enterprise build!
I’m running vSphere 6.0 on all this, complete with VSAN (one SSD and one HDD per NUC) for all the “production” virtual machines. The Pi (backed by the Drobo) is serving an NFS datastore for logging, VIBs, and general messing about. The ix4 is hosting a datastore via iSCSI but I’m not using it right now. The two older NUCs have two Ethernet connections (thanks to the Syba Mini-PCIe NIC) but the new one has just one. I’m using 802.1Q VLANs to segment traffic a bit.
If you’re interested in any of the components mentioned here (why I chose them, what I’m doing with them, or how they work) just leave a comment or ask on Twitter. Maybe I’ll write some of that up too!
What is NUT?
Network UPS Tools (NUT) is one of the oldest and most useful open source projects most people have never heard of. Essentially, NUT is an extensible and highly configurable client/server application for monitoring and managing power sources. It includes a set of hardware-specific drivers (e.g. usbhid, apcupsd, snmp), a server daemon (upsd), and clients like upsmon and upsc.
NUT traces its history back to some serious software and hacks from the 1996/1997 era to monitor APC UPSes. Originally called Smart UPS Tools, the name was changed to Network UPS Tools due to the unfortunate similarity of that old name with a particular line of APC UPS products. NUT supports a wide variety of hardware, including most USB-connected UPSes, many of the old serial interfaces, and SNMP UPSes and PDUs. Sadly, many APC UPS models are unsupported because they use the proprietary “Microlink” protocol, though APC has recently begun offering a supported protocol.
A Raspberry Pi NUT Server
As a client/server application, the upsd daemon can run on one machine designated to monitor one or more UPSes and can support multiple clients querying the status of these devices. The tiny Raspberry Pi makes a wonderful NUT server, since it offers USB connectivity, sufficient CPU and memory, and a full Linux environment in a tiny and low-power device. The Raspbian operating system, based on Debian, includes pre-compiled nut-server and nut-client packages.
Since I already had a Raspberry Pi model 2B in my mini datacenter, it was a simple matter to connect my two UPSes to it via USB. I did need to order the proprietary RJ50-to-USB cable for the APC Back-UPS, but this was under $6 delivered from eBay. I plugged in the USB cables, configured NUT, and I was up and running with a fully functional home power monitoring server!
Here’s the simple config I’m using:
- Set “MODE=netserver” in /etc/nut/nut.conf
- Configure my UPSes in /etc/nut/ups.conf
- Set the server to “LISTEN” on its IP address in /etc/nut/upsd.conf
- Create a upsd user and password in /etc/nut/upsd.users
- Configure upsmon to monitor these UPSes by setting “MONITOR” lines in /etc/nut/upsmon.conf
Once all this was set I simply stopped and restarted nut-server and nut-client and my Raspberry Pi NUT server was up and running!
A NUT Client for VMware vSphere
VMware vSphere does not include NUT support, but a VMware ESX native port of upsmon exists and works great. It even supports the latest version of vSphere, 6.0. Thank you, René!
I installed upsmon on all three of my ESX hosts (the NUC servers mentioned above) by downloading René’s package to my NFS datastore and running the install script in an ssh shell on each host. Although the instructions say it won’t require a restart, I found that I did have to reboot all of the servers to load the daemon and set up the configuration variables properly.
Configuring upsmon for ESX involves customizing the following variables:
- UserVars.NutUpsName – The name of one or more UPSes in [email protected] notation. If you enter more than one UPS name (separated by a space) the shutdown command will wait until all are exhausted.
- UserVars.NutUser – The upsd username set above.
- UserVars.NutPassword – The upsd password set above.
- UserVars.NutFinalDelay – The number of seconds to allow for a system shutdown after a low battery event is received.
- UserVars.NutSendMail – Enable (1) or disable (0) email from this upsmon instance.
- UserVars.NutMailTo – Email address to use for above.
Set these in the vSphere client by going to each host, clicking Settings, Advanced System Settings, and searching for “nut”.
I connected two of my NUCs to the larger CyberPower UPS and one to the smaller APC. I then configured each host to listed only for the UPS it is connected to. I also configured the NUT package in pfSense to monitor the UPS so it can shut down gracefully if there’s a power outage.
Stephen’s Stance
NUT is a wonderful and extensible power management framework, and the Raspberry Pi is an awesome platform on which to run the UPS monitoring drivers and upsd server daemon. Even if you’re not running vSphere, a Pi running NUT makes sense for the connected servers found everywhere today. My next task will be adding upsmon to the Iomega ix4 and other always-on systems!