SpeedTest via API

AutomationDude
Building a reputation

SpeedTest via API

Hello guys,

 

Trying to solve a a problem that shouldn't be solved with APIs by using APIs. Was wondering if you have any input.

 

I have a customer that wants to be alerted every time any of their networks (all with different ISPs) goes to an extremely low download speed below a certain threshold. There is the internal dashboard tool to view speed and of course speed test websites, but there isn't a direct API endpoint for speed.

 

I am going to try to use this one to infer if the speed is too slow however:

 

https://developer.cisco.com/meraki/api-latest/#!get-device-live-tools-ping

 

Is this a reasonable approach? Let me know if anything else comes to mind 🙂

 

13 Replies 13
sungod
Kind of a big deal

Might be worth trying...

 

https://developer.cisco.com/meraki/api-latest/#!get-organization-devices-uplinks-loss-and-latency

 

...it'll give you the loss+latency for a defined period for all MX devices in one go.

 

Run it every few minutes and look for increases vs. previous few samples or exceeding some learned/fixed thresholds.

 

RomanMD
Building a reputation

Hi,

while this make sense as a request, Meraki says not to rely on the Dashboard Speed test, since it is there just for having some idea, not for really getting correct figures.

This task has to be accomplished by installing a test-point in the network which will do this.That way you not only test the Internet line itself, but also the devices in between... Cisco has this feature with Thousand Eyes and there are rumours that Thousand Eyes will have a "Meraki" version...

 

On the other hand, read here: https://community.meraki.com/t5/API-Early-Access-Discussions/SpeedTest-Endpoint-not-working-as-expec...

RaphaelL
Kind of a big deal
Kind of a big deal

There is an endpoint but it is only available if you have inSight ( with the licence ).

 

{0}/devices/{1}/liveTools/speedTest?interface=wan1

 

Somehow , I can't find it in the openApispec nor the documentation.... It might have been renamed or removed.

RaphaelL
Kind of a big deal
Kind of a big deal

RaphaelL_0-1662467740502.png

 

It is probably in Beta , and you can only get the download speed not the upload speed... 

AxL1971
Building a reputation

I have written a simple application not using any API to download and upload a file and calculate download/uploads speeds.

mlefebvre
Building a reputation

How often should this be tested for? What destinations should be tested to (per-site)?  Are they aware that each speed test is potentially interfering with their own traffic? What is an "acceptable" threshold of speed? This is the sort of thing that really needs in-depth requirements and a lengthy caveat that if they test too often, they are only hurting themselves more by doing so..

 

Insight has a way to do API speedtests but I've not yet played with it too much. Having Insight monitor their key applications might be more helpful.

AutomationDude
Building a reputation

Thank you all for your input, gonna take this to the drawing board.

Crocker
A model citizen

Any chance you control a server/workstation on both ends of the link? Could look at iPerf testing between them. It's a little rough, but you can script around the iPerf3.exe to automate testing and log results per site.

Yoni
Conversationalist

I am trying to run a speed  test using API. Do you know where to find the device ID of the MX ? 
I am new to this. Apricate  your help 
 
 
 
import requests


payload = {}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {{apiKey}}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
Crocker
A model citizen

Fire a query at /organizations/{{orgid}}/devices

 

That'll return a listing of all the devices owned by the org, their names, serial #'s, mac addresses, and a bunch of other info.

 

Edit: Org, not Orc. This isn't Lord of the Rings.

Yoni
Conversationalist

Thank you so much , Crocker, for your quick help on this . I apricate it .  I was able to run the query you suggested.

I hope this is the one for the device ID . 

Yoni_0-1704496661007.png

 

 

Now , I am using the serial number of the MX and the device  ID as shown bellow, but I am getting 404 error code 

 

url = "https://api.meraki.com/api/v1/devices/Q3KY-XXXX-XXXX/liveTools/speedTest/2345543333"

 

 

 

Crocker
A model citizen

Create Device Live Tools Speed Test - Meraki Dashboard API v1 - Cisco Meraki Developer Hub

 

I think you need to read the speedtest endpoint documentation a bit more closely. To actually perform the speedtest you need to POST @ /devices/{{serial}}/liveTools/speedTest. This will perform the test, and return the results. Those results then get stored (tracked by a unique ID).

 

The query you have above is the query to retrieve the results of a previously run speedtest.

 

Edit: And note that this endpoint appears to only be available if you have the Early Access API enabled

Yoni
Conversationalist

Thank you so much for your help. I am on the right track now . 

Have a nice weekend 

Get notified when there are additional replies to this discussion.