• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
    • Stephen Foskett
      • My Publications
        • Urban Forms in Suburbia: The Rise of the Edge City
      • Storage Magazine Columns
      • Whitepapers
      • Multimedia
      • Speaking Engagements
    • Services
    • Disclosures
  • Categories
    • Apple
    • Ask a Pack Rat
    • Computer History
    • Deals
    • Enterprise storage
    • Events
    • Personal
    • Photography
    • Terabyte home
    • Virtual Storage
  • Guides
    • The iPhone Exchange ActiveSync Guide
      • The iPhone Exchange ActiveSync Troubleshooting Guide
    • The iPad Exchange ActiveSync Guide
      • iPad Exchange ActiveSync Troubleshooting Guide
    • Toolbox
      • Power Over Ethernet Calculator
      • EMC Symmetrix WWN Calculator
      • EMC Symmetrix TimeFinder DOS Batch File
    • Linux Logical Volume Manager Walkthrough
  • Calendar

Stephen Foskett, Pack Rat

Understanding the accumulation of data

You are here: Home / Everything / Terabyte home / Automated UPS Monitoring for vSphere with NUT and Raspberry Pi (Cheap!)

Automated UPS Monitoring for vSphere with NUT and Raspberry Pi (Cheap!)

June 3, 2015 By Stephen 9 Comments

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!

The Raspberry Pi is an awesome UPS monitor with the open source Network UPS Tools package
The Raspberry Pi is an awesome UPS monitor with the open source Network UPS Tools package

My Mini Datacenter

My mini datacenter is constructed from the following elements:

  1. Three Intel NUC servers
    1. 2x D54250WYKH (fourth generation i5)
    2. 1x NUC5i3MYHE (fifth generation i3)
  2. One TP-Link TL-SG2424 switch
  3. One Raspberry Pi (model 2B) connected to a Drobo
  4. An old Iomega ix4-200d
  5. A pair of UPSes
    1. CyberPower 1000AVR LCD
    2. APC Back-UPS ES 550

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!

You might also want to read these other posts...

  • Introducing Rabbit: I Bought a Cloud!
  • Tortoise or Hare? Nvidia Jetson TK1
  • Electric Car Over the Internet: My Experience Buying…
  • What You See and What You Get When You Follow Me
  • GPS Time Rollover Failures Keep Happening (But…

Filed Under: Terabyte home, Virtual Storage Tagged With: Amazon, APC, CyberPower, Network UPS Tools, NUC, NUT, pfSense, power, Raspberry Pi, UPS, upsd, upsmon, VMware, vSphere, vSphere 6

Primary Sidebar

Science is a differential equation. Religion is a boundary condition.

Alan Turing

Subscribe via Email

Subscribe via email and you will receive my latest blog posts in your inbox. No ads or spam, just the same great content you find on my site!
 New posts (daily)
 Where's Stephen? (weekly)

Download My Book


Download my free e-book:
Essential Enterprise Storage Concepts!

Recent Posts

Electric Car Over the Internet: My Experience Buying From Vroom

November 28, 2020

Powering Rabbits: The Mean Well LRS-350-12 Power Supply

October 18, 2020

Tortoise or Hare? Nvidia Jetson TK1

September 22, 2020

Running Rabbits: More About My Cloud NUCs

September 21, 2020

Introducing Rabbit: I Bought a Cloud!

September 10, 2020

Remove ROM To Use LSI SAS Cards in HPE Servers

August 23, 2020

Test Your Wi-Fi with iPerf for iOS

July 9, 2020

Liberate Wi-Fi Smart Bulbs and Switches with Tasmota!

May 29, 2020

What You See and What You Get When You Follow Me

May 28, 2019

GPS Time Rollover Failures Keep Happening (But They’re Almost Done)

April 6, 2019

Symbolic Links

    Featured Posts

    New England Takes On Seattle To Determine Who’s Number 2 … In Tech!

    January 19, 2015

    My Core i7 Macintosh SE

    May 25, 2017

    How Smart Is the Mondaine Helvetica Smart Watch?

    December 30, 2015

    Go Get a ProtonMail Account and Protect Your Online Life!

    July 19, 2017

    The Rack Endgame: Converged Infrastructure and Disaggregation

    September 19, 2014

    Introducing Rabbit: I Bought a Cloud!

    September 10, 2020

    From LAN Manager and SMB to CIFS: The Evolution of Prehistoric PC Network Protocols

    March 22, 2012

    My Advice For New Business Travelers: Get The Credit Cards!

    March 20, 2014

    Storage Changes in VMware vSphere 5.1

    September 4, 2012

    Microsoft’s Overlooked Innovation

    February 15, 2010

    Copyright © 2021 · Log in