I really would like to pull graphs from LibreNMS using Python. But I’m stuck on the command line. (Sorry - https has been removed from examples to circumvent the restriction of having too many links in my text)
A general request for my device works fine:
curl -H ‘X-Auth-Token: de1a4512’ ‘//librenms/api/v0/devices/lgb-pr1.core.fsknet.dk/ports/’
{
“status”: “ok”,
“ports”: [
{
“ifName”: “fxp0”
},
…
{
“ifName”: “xe-0\/1\/0”
},
{
“ifName”: “xe-0\/1\/1”
},
…
],
“count”: 108
}
But when asking for a specific port, things go all wrong:
curl -H ‘X-Auth-Token: de1a4512’ ‘//librenms/api/v0/devices/lgb-pr1.core.fsknet.dk/ports/xe-0\/1\/0/port_bits?from=-1w&to=-300’
{
“status”: “error”,
“message”: “Invalid graph type”
}
I can’t see how to avoid the \/ as the interface-descriptions written says so. Trying
curl -H ‘X-Auth-Token: de1a4512’ ‘//librenms/api/v0/devices/lgb-pr1.core.fsknet.dk/ports/xe-0_1_0/port_bits’
gives no output. And
curl -H ‘X-Auth-Token: de1a4512’ ‘//librenms/api/v0/devices/lgb-pr1.core.fsknet.dk/ports/xe-0_1_0/port_bits?from=-1w&to=-300’
<xhtml:div style=“display:table; width:300px; height:100px; overflow:hidden;”>
<xhtml:div style=“display:table-cell; vertical-align:middle;”>
<xhtml:div style=“color:rgb(128, 0, 0); text-align:center; font-family:sans-serif; font-size:0.6em;”>Error Drawing Graph: ERROR: start (1683653227) should be less than end (1683642127)</xhtml:div>
</xhtml:div>
</xhtml:div>
Any suggestions on what to do?
BTW - LibreNMS itself is perfectly happy with the interface:
Thanks - Jan Ferré