Looking for direction for a 3rd party API

Hi all,

I’ve been using a HostBill (Billing platform) PHP file/API which was intended for use with another NMS. It is used to pull through RRD data to generate graphs and billing.

The odd thing has broken in it over the years however the latest RRD changes appears to have broken it.

I’m just looking for a bit of direction on how to fix it. hb_get_image, listSwitches and listPorts work fine however hb_get_data gives a “false” output.

Could someone please point me in the right direction to what is broken?

http://pastebin.com/B9Dn9Q5m

Thanks

if (is_resource($rrd_process)) { - This won’t work anymore as $rrd_process is no longer set.

You probably want to use rrdtool($command, $filename, $options); in place of fwrite($rrd_pipes[0], "xport $graph_file $options $xport");

rrdtool_graph_xport() is broken. It makes assumptions about how rrdtool is set up.

I would suggest making the xport command use rrdtool() in rrdtool.inc.php or update it to match the rrdtool_graph() function in that same file.

You may have to submit a few changes upstream to make use of them, but we would accept those changes as long as they don’t violate any copyrights.

Another way that would make things better for future maintainability would be to use our official API http://docs.librenms.org/API/API-Docs/. This script uses internal structures which aren’t guaranteed to be stable.

Man, that code is pretty fragile and unnecessarily complex.

This worked for me. The problem with sendCommand is it would return before all the output was captured. I might change that upstream, but don’t have a need right now.

I also removed the ob_start() + debug=1, that was redundant.

http://pastebin.com/7XXQC1MU