Pushing CyberPower UPS to Grafana


Recommended Posts

Hi all, I wasn't exactly sure which forum section to ask this in, so apologies in advance if this is the wrong place. I am wondering if anyone has an idea how to install CyberPower PowerPanel Business Edition on my unRAID machine?

 

My unRAID server is connected by usb to a CyberPower UPS which shuts the server down during a power loss as desired. However, I would like to install PowerPanel Business Edition for Virtual Machines so that I can push my CyberPower UPS's info to Grafana using Telegraf and InfluxDB (possibly using this docker, though I'm not sure if I can do it more directly).

 

I found this guide for setting this up on ESXI, but since unRAID can't load VMs from OVA or OVF files I'm not sure what to do exactly.

 

Does anyone know if it's possible to create a VM running centOS on Unraid and then install PowerPanel Business Edition for Virtual Machines within that VM and still push the data to Grafana running in another docker on the host? Or does anyone have another suggestion for how to monitor my UPS within Grafana? Thanks.

Link to comment
  • 5 months later...
  • 2 weeks later...
  • 3 weeks later...

For what it's worth, here is the version of the script that @zandrsn mentioned that I heavily modified for use with Nut...this is working to pull what I wanted to pull from my USB-connected Liebert GXT3 UPS.  Also I'm terrible with this kind of stuff, so this took me several hours last night and there's probably stuff that could be improved LOL but if anyone else can get use out of it then I figure I might as well post it here to share!

 

#!/usr/bin/php
<?php

$command = "upsc";
$args = "ups";
$tagsArray = array(
"battery.charge", 
"device.model", 
"ups.status"
);

//do system call

$call = $command." ".$args;
$output = shell_exec($call);

//parse output for tag and value

foreach ($tagsArray as $tag) {

preg_match("/".$tag."\s*:\s*([\w|\s|\.|\/]+)\n/si", $output, $matches);

//send measurement, tag and value to influx

#print("$matches[1],$tag");
sendDB($matches[1], $tag);

}
//end system call


//send to influxdb

function sendDB($val, $tagname) {

$curl = "curl -i -XPOST 'http://[influxdb_ip]:8086/write?db=nut' --data-binary 'ups,host=tower,region=us-west $tagname=\"$val\"'";
$excsr = exec($curl);

}

?>

 

Edited by d.ohlin
Link to comment
  • 2 months later...

modified to the following & everything is working after a few modifications as I have actual wattage used instead of Percentage....

 

#!/usr/bin/php
<?php

$command = "upsc";
$args = "ups";
$tagsArray = array(
"battery.charge", 
"device.model", 
"ups.realpower", 
"ups.load", 
"battery.runtime", 
"output.voltage"
);

//do system call

$call = $command." ".$args;
$output = shell_exec($call);

//parse output for tag and value

foreach ($tagsArray as $tag) {

preg_match("/".$tag."\s*:\s([\d|\.]+)/si", $output, $match);

//send measurement, tag and value to influx

sendDB($match[1], $tag);

}
//end system call


//send to influxdb

function sendDB($val, $tagname) {

$curl = "curl -i -XPOST 'http://192.168.0.XX:8086/write?db=UPS' --data-binary 'APC,host=Tower,region=us-west "
.$tagname."=".$val."'";
$execsr = exec($curl);

}

?>

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.