Picture your ideal company technological infrastructure. Servers to handle day to day tasks, servers to do engineering simulations, network equipment to handle communication, network-attached storage for your company critical data, and last but not least, uninterruptible power supplies otherwise known as UPS. It’s a given that you will probably have monitoring setup on your servers, network equipment and even your network attached storage, but what about the UPS units? These definitely can be monitored, but it requires a bit of setup. In this 2 part post series, I’ll be detailing how SPK and Associates does monitoring of APC-based UPS units as part of our infrastructure support services.
The first part of this process involves setting up the UPS unit to be monitored. APC UPS units are pretty much the industry standard for a small to medium-sized datacenter. They offer several different models based on your power and on-battery time needs. Most (if not all) of their units have the ability to be monitored through their serial or USB console interface. For this example, we’ll be using the Smart-UPS 3000VA which features both a serial and USB console interface. You’ll need to hook up this console interface to a server, preferably one that has one of its power supplies hooked into the UPS unit. At one of our client’s sites, we ensured that every server had at least one power supply hooked up to a UPS unit. We’ll get into the reasoning for this a bit later, but for now, make sure the server that is hosting the monitoring has a power supply hooked up to the UPS unit.
Next, we’ll need to download the heart of this project, APCUPSD. APC actually offers their own monitoring solution called PowerChute, but from my experience, it’s not very user-friendly and requires a lot of setup to work properly, especially with SNMP-based monitoring. PowerChute also is geared towards Windows and does not offer easy integration with existing monitoring systems. APCUPSD is multi-platform, ties into existing monitoring systems, and best of all, it’s free! For this example, we’ll be setting up APCUPSD on a Linux-based server.
After downloading the RPM package, I install with the rpm command:
rpm -ivh apcupsd.rpm
Next, we need to setup the daemon to monitor our UPS unit attached to a serial or USB port of the server. The configuration file is located in /etc/apcupsd/apcupsd.conf. For simplicity sake, here’s a very basic configuration file which uses the USB interface of the server and UPS unit.
UPSCABLE usb UPSTYPE usb DEVICE LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable
Of course, these options can be modified and there are a lot more options to include in the configuration file, which I’ll get into more in Part 2 of this series. After editing the configuration file, you should have a simple, standalone UPS monitor daemon on your server. You can start it by running the start script, often found in /etc/init.d/apcupsd or by using the service apcupsd start command.
Once the daemon is up and running, you can query the UPS unit using the apctest program which allows you to view the status of the UPS unit as well as perform tests on it. This is a lot easier to do from a command line on Unix than a console interface on your laptop! Here’s a what the menu of apctest looks like:
Checking configuration ... Attached to driver: usb sharenet.type = DISABLE cable.type = USB_CABLE You are using a USB cable type, so I'm entering USB test mode mode.type = USB_UPS Setting up the port ... Creating the device lock file ... Hello, this is the apcupsd Cable Test program. This part of apctest is for testing USB UPSes. Getting UPS capabilities...SUCCESS Please select the function you want to perform. 1) Test kill UPS power 2) Perform self-test 3) Read last self-test result 4) Change battery date 5) View battery date 6) View manufacturing date 7) Quit
As you can see, there’s some basic tests you can do as well as view the status of the UPS. The test kill UPS power option is nice for verifying that your UPS units are working as expected. If you can see this menu, you’re good to go on to the next step of setting up the monitoring, which I will detail in Part 2!
Have a good or bad experience with APCUPSD? Need UPS unit advice? Feel free to post a comment and I’ll be happy to help out!
Systems Integrator, SPK and Associates