Any APIs to make a graph about traffic-flow by time?

SOLVED
Namgyu
Getting noticed

Any APIs to make a graph about traffic-flow by time?

Hi there,

 

We all see the graph of traffic by time to time within a day,

and I want to extract the usage amount in total network and make a new graph using Meraki dashboard APIs by python.

(ex - a bar graph moving to the left by 30 minutes interval automatically)

 

graph.PNG

 

I found some APIs about traffic like

'Get Network Traffic - https://developer.cisco.com/meraki/api/#/rest/api-endpoints/networks/get-network-traffic' and 'Get Network Client Usage History - https://developer.cisco.com/meraki/api/#/rest/api-endpoints/clients/get-network-client-usage-history'

 

But in 'Get Network Client Usage History', I can find only 1-day data not specific time interval(ex - 15 mins),

and in 'Get Network Traffic', I cannot see the total flow of usage data.

 

Do you know any proper APIs to make a graph like the image above?

 

Best Regards,

1 ACCEPTED SOLUTION
jdsilva
Kind of a big deal

I don't see any API's that are perfectly suited for this task. I would probably use this API:

 

https://api.meraki.com/api_docs#list-the-clients-that-have-used-this-network-in-the-timespan

 

To grab every client in a network for each time period, and then do some math inside my script to add up the total bytes sent and received from each client to get the totals needed to display a graph. 

View solution in original post

8 REPLIES 8
jdsilva
Kind of a big deal

I don't see any API's that are perfectly suited for this task. I would probably use this API:

 

https://api.meraki.com/api_docs#list-the-clients-that-have-used-this-network-in-the-timespan

 

To grab every client in a network for each time period, and then do some math inside my script to add up the total bytes sent and received from each client to get the totals needed to display a graph. 

Namgyu
Getting noticed

Thank you for sharing your good idea!
Namgyu
Getting noticed

Dear @jdsilva,

When I tried making codes with API you recommended, I could get the result of real-time usage!
I am going to study more and make an output I wanted.

Thank you again!
jdsilva
Kind of a big deal

Oh cool. Good to know you can get that info from that API. Thanks for reporting back!

Kausik
Comes here often

I am trying to use 

 

https://api.meraki.com/api/v0/networks/<network_id>/clients/<client_id>/trafficHistory?startAfter=15...

 

Return is like following:

{
        "ts"1557964800.0,
        "application""UDP",
        "destination""198.58.40.248",
        "protocol""UDP",
        "port"5020,
        "recv"118,
        "sent"193,
        "numFlows"1,
        "activeSeconds"60
    },
    {
        "ts"1557964800.0,
        "application""UDP",
        "destination""198.58.40.248",
        "protocol""UDP",
        "port"5022,
        "recv"965,
        "sent"959,
        "numFlows"1,
        "activeSeconds"120
    },
    {
        "ts"1557964800.0,
        "application""UDP",
        "destination""198.58.40.248",
        "protocol""UDP",
        "port"5024,
        "recv"6953,
        "sent"6793,
        "numFlows"1,
        "activeSeconds"720
    }

the timestamps we are getting are in date value, not getting any date and time values. Can someone tell me the reason?
Namgyu
Getting noticed

You got ts(timestamp) in result from the API.
For instance, timestamp 1557964800.0 can be converted to 2019-May-16 Thursday AM 12:00:00 (GMT).
It includes time values.

But why do you think you only can get date values?
Kausik
Comes here often

As the time value, after conversion we are always getting 00:00:00, no other real values after conversion.If you check the example I shared, all the ts values ends with "00"

 

I am not sure if I need to add activeSeconds with the ts value or not

@Kausik , did you ever solve the issue where trafficHistory is only returning the date?  I'm running into the same problem.  

Get notified when there are additional replies to this discussion.