Skip to content

A UPS in a Virtual World

August 11, 2015

41zXOFArsvL[1]A while back we “converted” or “upgraded” from a number of separate machines to one big server machine running Xen.  There were a number of advantages to this approach for both capacity and management, as well as getting some increased horsepower for operations.  The one thing that didn’t make the transition easily was the way the UPS was being handled.

Like just about everyone, all the server machines are on a fairly large UPS and have been since the beginning.  The problem has always been handling notification between the machine the UPS is connected to and the rest of the machines.  There are a number of somewhat OK solutions for this, some pretty costly and some free.  Unfortunately the common theme for all of these is they don’t work all that well straight out of the box.

Recently, we upgraded the NAS from a Thecus to a Synology box and increased the capacity significantly.  The Thecus was getting a bit old and the software support for it has not been what it could have been – meaning existing customers more or less got forgotten by the company.  Synology has a far better software offering and is more compatible with the way things work here.  So we moved over to it.  As part of this, we needed to figure out a UPS sharing strategy that worked with the Synology box.

It turns out that there is one and only one UPS sharing solution that works with Synology – NUT or Network UPS Tools.  It is an open-source Linux/Unix tool originally but has been ported to both Mac OS and Windows in a sort-of satisfactory manner.  With this in mind, the implementation of NUT on all of the various servers (virtual and physical) connected to the “big” UPS was started.  It should be said that a “big” UPS these days is a lot smaller than you might think, if you aren’t buying UPSs for a company.  The days when a server could be expected to need a huge power supply for lots of hot hard drives is over.  Our server running Xen uses all 2.5 inch drives and even with dual redundant power supplies is very comfortably served with a 1500 VA UPS.

Of course, the first thing right out of the box that was discovered was that the documentation for Synology is great for sharing a UPS between multiple Synology boxes but utterly absent for sharing a UPS with anything else.  Synology uses a Linux base for their software and in keeping with the whole open-source idea the documentation was an afterthought.  NUT being open-source as well suffers from the same problem: nobody is getting paid to produce documentation and it just isn’t as sexy as writing code.

It seemed like the simplest alternative was to first plug the UPS into the Synology box and then figure out how to get the other “clients” to communicate with it.  It puts the onus of managing the UPS hardware connection onto Synology and there is no shortage of things saying that works.

So, with a number of Windows machines as “clients” for the UPS sharing, the next step was to find a Windows port of NUT that was complete enough to act as a client for the Linux Synology implementation.  What I managed to find was NUT-Installer-2.6.5-6.msi.  This was on the SourceForge web site for NUT and it is sort of complete.  It does include some dependencies that are installed with it, but somehow the builder of this package seems to have assumed that everyone has OpenSSL installed on their Windows machine.  It also makes some assumptions about it being OK to split up executable files into “bin” and “sbin” but not copy the DLL files in “bin” over to “sbin”.

What I did was find an OpenSSL .ZIP file and extract the necessary DLL files for NUT to work.  These files have to go in both the “bin” and “sbin” folders.  Another technique would be to properly install OpenSSL with these DLL files in something like the Windows\System32 folder – this didn’t seem to be necessary or all that desirable.

After finding that critical programs wouldn’t start properly from the “sbin” folder because of missing DLLs, all the DLL files from the “bin” folder were copied over to the “sbin” folder.  If you aren’t terribly adept at using Event Viewer you might not catch this problem right off and it will take considerable work to figure out what is going on.  I recommend just copying the files over and leaving it at that.  Another solution might be to move all the “sbin” stuff to the “bin” folder but that seemed like it might involve more severe configuration changes and might even require a recompile – which I did not want to do.

As a note aside, I didn’t want to recompile NUT for Windows because it is uses GCC and MSYS (a derivation or modern version of MinGW) and it would require installing a whole new toolset in order to compile it.  Sure it might be the “right” way, but it is also rather time-consuming so I really wanted a solution that would work from binary, pre-built files.

After figuring out how to tailor the configuration files for NUT on Windows to get it to work as a “slave” to the Synology box, I had three tailored configuration files out of six.  The others simply aren’t used.  There are a few key points when connecting a client to the Synology implementation:

  • The Synology UPS is called “ups”.  This doesn’t appear to be documented anywhere officially.  I did find a posting that referenced this but it is a fairly obscure and extremely necessary fact.
  • The user and password for connecting to the Synology UPS service is “monuser” and “secret”.  Again, no official source for this and I had to find it by digging through files on the Synology box.  Turns out I found this elsewhere in posts but buried pretty deeply.
  • There is a reference to a file in the UPSMON.CONF file and this must be changed from the default for Windows – the Windows distribution comes with the default set to something that will not work on Windows.

The last thing to do to get a client up and running is to start the “Network UPS Tools” service.  This is probably easiest done through the “Services” applet on Windows but I suppose one could use the command:

net start “Network UPS Tools”

with the caveat that the quotes are very important.

You will note that there isn’t any sort of indication externally that the NUT client is running.  It is hidden away as a service without any sort of user interface and no user-mode program that will say it is running properly.  There is a separate NUT client that is available called “” out there that is actually a Windows user interface client.  All it does is display the status of a NUT “master”, so it isn’t useful for getting your Windows box to shut down in an orderly fashion when the UPS is running out of battery power.  But this program can be helpful in figuring out that the “master” is running and the UPS is doing what it is supposed to do.

The Synology box does not provide any indication of what “slave” or “client” computers are connected to it and therefore isn’t capable of telling you anything about your configuration.  How do you know everything is working?  I am going to say the only answer is to try it – unplug the UPS – and see what happens.

Trying to do this with other software, such as the APC stuff, wouldn’t have worked with any NAS box and it is not a nice installation on Linux in any respect.  Other open-source solutions exist, such as apcupsd, but they don’t get along with Synology.  I will say that the Synology implementation here seems to be very flexible in that while it is an APC UPS today there are a huge number of manufacturers that are supported by NUT and having the “master” being the Synology box isolates all of the clients from the details of the UPS hardware.

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: