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);
}
?>