In an effort to monitor as much data as possible in order catch subtle warning signs of failure, it occurred to me it would be nice to monitor my UPS in case of long term wear.

A quick Google search turned up one result for graphing power panel results using Munin ( However, I am using Cacti and embarked on making my own template. To be honest, I used Eric A. Hall’s IPMItool sensor template as a boiler plate for my own. I changed what was needed to get it working and now it has no issues.

Download cacti-pwrstat-sensors.0.1.tar.gz

After downloading the code above you can follow the instructions from most of Eric’s Cacti software ( however for simplicity I will post the steps here:

1) The first step is to allow www-data (or whoever the cacti poller runs as) to access the command /usr/sbin/pwrstat. To do you must allow the user sudo access without a password. Open a terminal window and type: visudo. Add the following line to the end of the file:

www-data        ALL=(ALL) NOPASSWD: /usr/sbin/pwrstat

2) Download cacti-pwrstat-sensors.0.1.tar.gz to a temporary directory on the Cacti server machine.

3) Expand the archive with the command tar -xvzf cacti-pwrstat-sensors.0.1.tar.gz.

4) Copy scripts/ss_pwrstat_ups.php to the /scripts/ directory.

5) Copy resource/script_server/pwrstat_ups.xml to the /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, open the templates folder, and import the data query templates. Cacti should automatically create the required data template, data input method, graph template, and data query.

7) Click on the “Data Queries” menu item on the left side of the Console screen and verify that a “UPS – Sensors” data query is present. Click the name of the object and verify that Cacti was able to locate and read the XML resource file.

8) Click on the Devices menu item on the left side of the Console screen, select a device that you wish to associate with the UPS information, and scroll down to the “Associated Data Queries” table at the bottom of the screen. Select “UPS – Sensors” in the “Add Data Query” drop-down box, and click the “Add” button.

9) After the Device screen reloads, verify that the data queries added in step 7 above are present, and then click the “Create Graphs for this Host” link at the top of the page.

10) Once the screen finishes loading, locate the “UPS – Sensors” data query. Select the sensors that you want to monitor, and click the “Create” button at the bottom of the screen to include them in the polling process.

Again, 100% credit goes to Eric A. Hall for the instructions and boilerplate. This hasn’t been tested much however it is working on two servers without issues, so far.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *