Getting In, Out, Average and 95th percentile from API

I am trying to create a report generator using data retrieved via API. I am getting hostname, interface Name but I am not able to get data for In, Out, Average and 95th percentile. The port api call gives following data
{
“status”: “ok”,
“port”: [
{
“port_id”: 1222,
“device_id”: 101,
“port_descr_type”: null,
“port_descr_descr”: null,
“port_descr_circuit”: null,
“port_descr_speed”: null,
“port_descr_notes”: null,
“ifDescr”: “bond0”,
“ifName”: “bond0”,
“portName”: null,
“ifIndex”: 6,
“ifSpeed”: 1000000000,
“ifConnectorPresent”: “true”,
“ifPromiscuousMode”: “false”,
“ifHighSpeed”: 1000,
“ifOperStatus”: “up”,
“ifOperStatus_prev”: “up”,
“ifAdminStatus”: “up”,
“ifAdminStatus_prev”: “up”,
“ifDuplex”: null,
“ifMtu”: 1500,
“ifType”: “ethernetCsmacd”,
“ifAlias”: “bond0”,
“ifPhysAddress”: “1866da4db47c”,
“ifHardType”: null,
“ifLastChange”: 0,
“ifVlan”: “”,
“ifTrunk”: null,
“ifVrf”: 0,
“counter_in”: null,
“counter_out”: null,
“ignore”: 0,
“disabled”: 0,
“detailed”: 0,
“deleted”: 0,
“pagpOperationMode”: null,
“pagpPortState”: null,
“pagpPartnerDeviceId”: null,
“pagpPartnerLearnMethod”: null,
“pagpPartnerIfIndex”: null,
“pagpPartnerGroupIfIndex”: null,
“pagpPartnerDeviceName”: null,
“pagpEthcOperationMode”: null,
“pagpDeviceId”: null,
“pagpGroupIfIndex”: null,
“ifInUcastPkts”: 56175330565,
“ifInUcastPkts_prev”: 56174310943,
“ifInUcastPkts_delta”: 1019622,
“ifInUcastPkts_rate”: 3399,
“ifOutUcastPkts”: 53204924117,
“ifOutUcastPkts_prev”: 53203934904,
“ifOutUcastPkts_delta”: 989213,
“ifOutUcastPkts_rate”: 3297,
“ifInErrors”: 0,
“ifInErrors_prev”: 0,
“ifInErrors_delta”: 0,
“ifInErrors_rate”: 0,
“ifOutErrors”: 0,
“ifOutErrors_prev”: 0,
“ifOutErrors_delta”: 0,
“ifOutErrors_rate”: 0,
“ifInOctets”: 24082135880769,
“ifInOctets_prev”: 24081652785175,
“ifInOctets_delta”: 483095594,
“ifInOctets_rate”: 1610319,
“ifOutOctets”: 21539614327911,
“ifOutOctets_prev”: 21539116629542,
“ifOutOctets_delta”: 497698369,
“ifOutOctets_rate”: 1658995,
“poll_time”: 1552042509,
“poll_prev”: 1552042209,
“poll_period”: 300
}
],
“count”: 1
}
Any idea how to retrieve it without rrd command ?

You have to use billing. Normal polling is not accurate because it degrades data resolution over time and it is only calculated via rrd there.

Alright. Just another thought, is there any way to convert those octets into commonly used formats like Mbps or Kbps? Thanks for your suggestions.

yes octet is one byte or 8 bits. You can figure out the rest of the calculations.

Yeah I know that. I just wanted to know if there is any inbuilt mechanism. If that’s not the case then I guess going withh RRD is the best option. Anyways, thanks for the instant reply.

I’m not sure what you mean here. Billing shows you bps. So there is no need for conversion. As I said, I would only use RRD if you don’t care about accuracy.

2 posts were split to a new topic: Group ports for billing