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.