Network Devices Latency Stats

csullmeraki
Here to help

Network Devices Latency Stats

I am trying to access all the data from the NetworkDevicesLatencyStats call using python with the following function:

 

def getWirelesStats(network_id):
    print("\nMeraki Wireless Settings")
     response  = dashboard.wireless_health.getNetworkDevicesLatencyStats(network_id, timespan=86400)
     a = json.dumps(response)
     b = json.loads(a)
     print(b)

 

What would be the best way to parse through this to be able to print out the serial, latency stats, and voice/video traffic, etc from a pythonic standpoint? Thanks!

 

Right now I just get this dump:

 

{ "serial": "Q2JC-2MJM-FHRD", "latencyStats": { "backgroundTraffic": { "rawDistribution": { "0": 1234, "1": 2345, "2": 3456, "4": 4567, "8": 5678, "16": 6789, "32": 7890, "64": 8901, "128": 9012, "256": 83, "512": 1234, "1024": 2345, "2048": 9999 }, "avg": 606.52 }, "bestEffortTraffic": "same shape as backgroundTraffic", "videoTraffic": "same shape as backgroundTraffic", "voiceTraffic": "same shape as backgroundTraffic" }

 

1 Reply 1
sungod
Kind of a big deal

you can probably do something like this, not elegant though 🙂  ...

 

for r in response:   # iterates through all the devices found

    print(r['serial'])

    ls = r['latencyStats']

    bt = ls['backgroundTraffic']

    print(bt['avg'])

    rd = bt['rawDistribution']

    for rdi in ["0", "1", "2", "4", fill in the rest of the indices]:

        print(rd['rdi'])

 

I've just typed this on the fly, obviously you'd want to format the printing properly

Get notified when there are additional replies to this discussion.