kb8u, I think we're on the right track. The command appears to be running correctly, but my graph is showing all -NaN values (and a find command does not find the RRD file anywhere on the server?!?!?).
I'll jump in chat to try to get some help on the graph issue. Anyways...
Since my PDUs report current in tenths of amperes, I had to do a calculation:
/bin/echo print '"OK|total="',"(`rrdtool lastupdate /opt/zenoss/perf/Devices/10.11.12.13/PDUComponent/OUTLET1/amps_amps.rrd | /usr/bin/tail -1 | /bin/cut -d' ' -f2,2` + `rrdtool lastupdate /opt/zenoss/perf/Devices/10.99.98.97/PDUComponent/OUTLET2/amps_amps.rrd | /usr/bin/tail -1 | /bin/cut -d' ' -f2,2`)/10" | /usr/bin/bc -l
Since the derived amperage value was less than one, and bc performs integer division by default, everything was coming back as zeroes. I had to add the '-l' flag to bc, which sets the default precision of 20 places after the decimal. So my output looks like this:
OK|total=.40000000000000000000
The excess precision has no detrimental effect on the graph. For the record:
OK|total=.40000000000000000000
The string between the pipe and the equal sign must precisely match the name of the DataPoint you are trying to graph. This was the reason my RRD file was not being created. I assume this means the RRD files are not created until the first data value is retrieved?
which is mathematically correct, but I don't know what effect, if any, this will have on the graph. I've was trying to use the bc 'scale' function to control the precision, but I ran into some difficulty:
/bin/echo print '"OK|total="',"scale=3;(`rrdtool lastupdate /opt/zenoss/perf/Devices/PDU1/outlets/OUTLET1/amps_amps.rrd |
/usr/bin/tail -1 | /bin/cut -d' ' -f2,2` + `rrdtool lastupdate /opt/zenoss/perf/Devices/PDU2/outlets/OUTLET2/amps_amps.rrd | /usr/bin/tail -1 | /bin/cut -d' ' -f2,2`)/10" | /usr/bin/bc -l
OK|total=3.400 // Note that instead of interpreting the 'scale=3' expression to indicate 3 places behind the decimal, bc simply outputs '3' in this case. Which is... interesting. After a fair bit of experimentation, I found this to work in bash:
/bin/echo -n "OK|total=";/bin/echo "scale=3;(`rrdtool lastupdate /opt/zenoss/perf/Devices/PDU1/outlets/OUTLET1/amps_amps.rrd | /usr/bin/tail -1 | /bin/cut -d' ' -f2,2` + `rrdtool lastupdate /opt/zenoss/perf/Devices/PDU2/outlets/OUTLET2/amps_amps.rrd | /usr/bin/tail -1 | /bin/cut -d' ' -f2,2`) /10" | /usr/bin/bc -l
OK|total=.400 //precisely what I am looking for!
BUT! When testing this from within Zenoss, I get this:
Executing command /bin/echo [args omitted] against localhost
OK|total=
.400
DONE in 0 seconds
So, it seems that Zenoss is not respecting the '-n' flag for the echo command. Any ideas?