PowerAlert UPS Monitor

November 11, 2010

Tripp-Lite PowerAlert is a UPS monitoring and management program designed for use with Tripp-Lite UPS systems, although it can also be used with a variety of other vendors' equipment. Moreover, PowerAlert v12 is designed to be queried by software agents on the network, which it does by exposing information about the local UPS devices via SNMP tables on a private port number. This script template takes advantage of this design by acting as a PowerAlert client, querying the PowerAlert v12 daemons through the private interface, extracting the operational information for each of the connected UPS devices, and then generating multiple graphs from the collected data.

Figure 1
Figure 1

For illustration purposes, the graphs in the figures at right show the "Power Input" graphs for a Windows 2003 server running PowerAlert 12.04 communicating with an MGE Pulsar Evolution 1100 and a Tripp-Lite SMART2200RMXL2U via local USB interfaces, while the additional pair of graphs below show the "Load Capacity" output for the same two devices, and a separate graph shows the battery temperature for the Tripp-Lite UPS. I also use these same tools to monitor the same data on a variety of APC ES 650 and 750 UPS devices that serve the individual desktop systems. However, PowerAlert does not provide all of the data from all of the UPS devices—of the three UPS brands I have in use here, PowerAlert only displays the full set of data for the Tripp-Lite UPS.

Specifically, the PowerAlert software has a few dozen device variables that it tries to track and make available to other PowerAlert nodes on the network, although the amount of data that it can make available depends on how much information it is able to extract from the UPS device itself. The attributes that can be monitored are enumerated in an SNMP table by name, with the associated values being stored in a sister table.

Figure 3
Figure 3

Since the attributes are not keyed to common OIDs, but instead are keyed to the textual attribute name, it is necessary to use a script in order to first determine the data that is available, and then to query for the associated values after that. Furthermore, the use of an application-specific SNMP community string and port number also creates some difficulties, since Cacti does not currently provide a way to store application-specific variables with a device.

Note that the PowerAlert software architecture has recently changed, and depending on your needs, you may want to use either PowerAlert v12.03 or v12.04. PowerAlert v12.03 used a peer-to-peer model whereby every installation was capable of monitoring remote PowerAleter nodes, and was also capable of being monitored by other PowerAlert nodes. Meanwhile, PowerAlert v12.04 introduced a more rigid client-server hierarchy, whereby PowerAlert Local provided server functionality only and was not able to monitor remote devices, while separate shutdown agents were used to monitor the server devices. v12.04 is more appropriate if you limit your UPS devices to a few server devices, but v12.03 is more appropriate if you use a combination of local and remote UPS devices to provide protection at multiple layers. The two versions are interoperable with each other, so it's possible to use v12.03 on some systems and v12.04 on others without much trouble.


To use this script template, perform the following steps:

  1. Download and install the PowerAlert component software that is most appropriate for your network architecture, and configure it accordingly. Verify that a PowerAlert server agent is running on the target system and responding to SNMP queries by using the snmpwalk command with the community name of "tlremote" or "public" or "tripplite" and the SNMP port number of 3664.
  2. Download cacti-poweralert.0.6.tar.gz to a temporary directory on the Cacti server machine.
  3. Expand the archive with the command tar -xvzf cacti-poweralert.0.6.tar.gz, and change to the cacti-poweralert directory that is created.
  4. Copy scripts/ss_poweralert_ups_status.php to the <cacti>/scripts/ directory.
  5. Copy resource/poweralert_ups_status.xml to the <cacti>/resource/script_server/ directory.
  6. Access the Cacti installation in a web browser, click on the "Import Templates" menu item on the left side of the Console screen, and import the template/poweralert_ups_status_data_query.xml file. Cacti should automatically create the required graph template, data input method, and data template objects.
  7. Click on the Devices menu item on the left side of the Console screen, select a host that is running one of the PowerAlert v12 server agents, and scroll down to the "Associated Data Queries" table. Select "TrippLite PowerAlert - UPS Statistics" in the "Add Data Query" drop-down box, and click the "Add" button.
  8. After the Device screen reloads, verify that the "TrippLite PowerAlert - UPS Statistics" data query is now present, and then click the "Create Graphs for this Host" link at the top of the page.
  9. Figure 4
    Figure 4
  10. Once the screen finishes loading, locate the "TrippLite PowerAlert - UPS Statistics" data query, which should be similar to the figure at right. At the bottom right of the list is a drop-down box containing three available graph types for the data query. Select the graph type that you want to generate, then select the UPS device(s) that you want to monitor, and then click the "create" button at the bottom of the screen to include the required data in the poller process. If you wish to create multiple graphs for multiple devices, you will need to repeat this process for each graph type.

Note: these files are intended to be used with Cacti 0.8.6 and 0.8.7 and PHP 5.2, and may not operate as expected with other versions.

Script Input and Output

In some cases you may want to execute the script file manually for debugging purposes. The parameters to the script use a fixed structure that is optimized for use with the Cacti poller, but also allows for human interaction. In particular, the script uses three parameter groups, with the exact structure depending on the SNMP version in use and the output that is desired.

The first parameter group provides an SNMP protocol "bundle" of the following values, separated by colon characters: In those cases where a value is unneeded (such as SNMP v3 authentication credentials for an SNMP v2 query), or where a default value is adequate (such as the SNMP port number), the value can be omitted.

Taken as a whole, a valid SNMP bundle for the localhost device using SNMP v2 with the community string of "tlremote" on the default port number and a default timeout would be "localhost:2:tlremote::::::::".

The next parameter identifies the type of Cacti data that is being requested. Cacti uses "index" queries to enumerate all of the entries for a data query template, and then uses various kinds of "query" queries to obtain extended information about those entries (such as the full name of each indexed entry). Separately, the Cacti poller uses "get" queries to fetch the readings for each specific entry (again, keyed by index value). Note that he index and query operations are typically only performed when the device entry is being created or modified, and the get operations provide the actual readings to the poller. This script parameter must be one of those query types, with any remaining parameters providing any necessary supplemental data. Specifically the request parameters are one of the following:

The field names that can be used in "query" or "get" requests are as follows:

You must know the index value that has been assigned to a device before you can ask for details about that specific device. To do this, you can use the "query upsname" request to get a list of UPS devices and their descriptions, and then use the "get <fieldname> <ups>" request to get information about the desired UPS. The full command lines for these requests, using example data from above, are shown below:

$ php ss_poweralert_ups_status.php hostname:2:tlremote:::::::: query upsname
2:Evolution 1100

$ php ss_poweralert_ups_status.php hostname:2:tlremote:::::::: get outputload 1
-- 30 --
Copyright © 2010-2017 Eric A. Hall.