I’m using the API to get aggregate data usage for the customer portal:
API DOC: https://sonar.software/apidoc/#api-Account_Data_Usage-GetAccountDataUsages
example usage: https://example.sonar.software/api/v1/accounts/:id/granular_data_usage/:start_time/:end_time
The script returns the data in timestamp chunks, I foreach loop parse them into a per-day arrays and add them all together (because I don’t need that granular of data but this is all I could seem to find to accomplish this specific task)
So my end result is an array that looks like this for each IP address in the account:
->->->IN total for that day (in bits)
->->->OUT total for that day (in bits)
So my question:
according to the API docs, I’m receiving the data in bits and per IP I get IN and OUT data only (not application data as shown in the docs which is actually better for me anyway)
I will use 2017-10-22 as an example:
->-> Date: 2017-10-22
IN = 400641693 bits / 1000000000 (to get gigabits) =0.400641693 Gbits
OUT = 26824094 bits / 1000000000 = 0.026824094 Gbits
According to my math there was incredibly little usage on this account but my routers bandwidth tracker shows a much higher data usage for that day on that specific IP. I’ve tried many other days and other IP’s on the account, all with the same low results.
So where am I going wrong? is it the API returning a different number units then expected ie. Megabit or Megabyte? or not showing all of the accounts netflow data for some other reason?
Thanks in advance for anyone help you can help with this.