I want to be able to fetch switchport data via the API similar to how I would with SNMP, for the 'usual' metrics:
- Speed/Duplex
- Operational / Administrative Status
- Throughput
- Error packets / packet types.
All of this is exposed via the API, but to the best of my knowledge, I have to make three separate calls per switch to retrieve all of this info. This isn't a problem, until the rate limiting kicks in. I do have backoff logic in place, but apparently it's not always cutting it.
This is what I'm doing, does anyone know of a way to reduce the calls?
// Retrieve interface packet counts for the switch.
query('/api/v0/devices/' + device.serial + '/switchPortStatuses/packets?timespan=' + TIMESPAN)
// Retrieve interface usage counts for the switch
query('/api/v0/devices/' + device.serial + '/switchPortStatuses?timespan=' + TIMESPAN)
// Retrieve interface statuses for the switch. Cannot use the above call because it blanks out 'status' values when a timespan is applied.
query('/api/v0/devices/' + device.serial + '/switchPortStatuses')