API - port bits graph

Hi all,

Is anyone aware how to specify time from and to in API request when querying a graph?

Thanks

Yes, you can pass to and from, it’s in the API docs.

problem is, it’s not :frowning:

from: This is the date you would like the graph to start - See
http://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html for more information.to: This is the date you would like the graph to end

API command is different to RRD command and will not passthrough. Any ideas?

And you’ve tried what exactly?

Well that’s exactly my point, there are no examples specifying from and to values in API calls. API call does not reference RRD graph does it?

Do you have an example for this:
http://localhost/api/v0/portgroups/multiport/bits/GRAPH_ID***WHAT_GOES_HERE? > peering_x.png

Thank you

?from=&to=

Just tried this using a script from someone on this forum:

now=date +%s
daysecs=86400
weeksecs=604800
dayago=$((now - daysecs))
weekago=$((now - weeksecs))

curl -H “X-Auth-Token: XYZ” http://localhost/api/v0/portgroups/multiport/bits/320&from=$dayago&to=$now > test.png

I’m still seeing same graphs as if i didn’t specify from and to values :frowning:

Seems ok for me:

curl -k -H 'X-Auth-Token: TOKEN' 'https://web01.lathwood.uk/api/v0/devices/localhost/ports/eth0/port_bits?from=-1w&to=-300' > /opt/librenms/html/test.svg

http://web01.lathwood.uk/test.svg which gives more than the just the default last 24 hours.