Apcupsd (American Power Conversion uninterruptible power supply daemon) is a utility that runs on Linux, UNIX, macOS and Windows. Apcupsd can be used for power management and control. As an example, during a power failure, Apcupsd will inform users about the failure and that a shutdown has occurred and therefore can be used for power management and control. Apcupsd is licensed under the GPL version 2.
Apcupsd runs in daemon mode, allowing it to keep a live connection with a UPS (uninterruptible power supply) at all times. It can be configured a few different ways depending on your preferences. First, it can poll the UPS on a regular basis to learn about its current state. Or, it can also receive messages from the UPS itself using SNMP traps to learn the same information.
Apcupsd is notable in that it can also communicate with other instances of itself on separate machines, thus maintaining a client-server relationship with them. Using this configuration, users could potentially power multiple computers with a single UPS - this despite the fact that only one of them would be connected directly to the data port on the UPS itself.
Apcupsd was developed to be a free equivalent to a piece of proprietary software developed by APC, called Powerchute. Indeed, they support many of the same features and are used in essentially the same way. As of the 3.14.0 release of Apcupsd, it even includes a network shutdown function that Powerchute quickly became known for. Apcupsd is written in C++ and it also works with some original equipment manufacturer power supplies, most notably those designed and developed by Hewlett Packard and others.
Why use a Telegraf plugin for Apcupsd?
Power supply monitoring is important to ensure your networks, servers, and overall infrastructure is operational in the event of a failure. An Uninterruptible Power Supply (UPS) is a backup power source that activates when the main source of power fails. Even if you have a UPS, it is important that you proactively monitor your UPS to help you get through a power outage without any interruptions. The Apcupsd Telegraf plugin collects metrics and events to help you get critical insights on battery charge and performance and allow you to set warnings depending on the thresholds you set. You can also set alerts to warn you when a battery needs to be replaced or when a battery cannot sustain the requirements of a network.
This is also important because when some type of shutdown or power loss does occur, depending on your environment, you may need to shut things down in a particular order to avoid data loss or other types of issues. This is known as an orderly shutdown, and it is literally one of those situations where time is of the essence because a UPS only has so much power in it at any given moment. By alerting you to an issue as quickly as possible, Apcupsd lets you perform that orderly shutdown so that you can pick right back up again later like nothing ever happened.
How to monitor Apcupsd using the Telegraf plugin
Getting started with the Apcupsd Telegraf plugin is simple — provide a list of running apcupsd servers to connect, and Telegraf will start ingesting metrics into InfluxDB. You can also set a timeout for the server.
Thankfully, configuring Apcupsd on your own environment is a straightforward process that you can complete in a matter of seconds. Simply use the following commands, just replace the default values with the ones that make the most sense given your infrastructure:
[[inputs.apcupsd]] # A list of running apcupsd server to connect to. # If not provided will default to tcp://127.0.0.1:3551 servers = ["tcp://127.0.0.1:3551"] ## Timeout for dialing server. timeout = "5s"
Key Apcupsd metrics to use for monitoring
Some of the important Apcupsd metrics that you should proactively monitor include: