504 Gateway Time-out when using getNetworkClients with a filter

PhilipDAth
Kind of a big deal
Kind of a big deal

504 Gateway Time-out when using getNetworkClients with a filter

I am trying to locate all Raspberry Pis in an org.  Lucky for me, they all have a MAC address that starts with b8:27:eb.  So I start with this code:

		try:
			for client in dashboard.networks.getNetworkClients(net['id'],total_pages='all',timespan=7*86400,mac="b8:27:eb"):
				if(client['mac'].startswith("b8:27:eb:")):
					print(f'"{net['name']}",{client['mac']},{client['ip']},"{client['description']}"')
		except meraki.exceptions.APIError as e:
			print(f"Skipping {net['name']}: {e.reason}",file=sys.stderr)

 

I hit a network with about 20,000 clients, and no Raspberry Pi's, and all I get is:

networks, getNetworkClients - 504 Gateway Time-out

 If I remove the mac="b8:27:eb" filter it woks perfectly - but oh so slow.  It seems it spends so long searching (and finding nothing), and the lack of anything being returned causes the Meraki gateway to time out.

 

@JohnIngram 

10 Replies 10
RaphaelL
Kind of a big deal
Kind of a big deal

Hi Phil ,

 

I suppose the MAC has to be in the format xx:xx:xx:yy:yy:yy and not just with the OUI.

KarstenI
Kind of a big deal
Kind of a big deal

A partial match is at least supported based on the documentation.

If you found this post helpful, please give it Kudos. If my answer solves your problem, please click Accept as Solution so others can benefit from it.
RaphaelL
Kind of a big deal
Kind of a big deal

Indeed , I just read it.  However , I'm not getting any results either but I'm getting a HTTP 200 with an empty list.

if I remove the filter on the MAC the client is present.

 

https://api.meraki.com/api/v1/networks/xxxxxxxx/clients?perPage=1000&mac="de:89:c2"

returns http 200 []

https://api.meraki.com/api/v1/networks/xxxxxxxx/clients?perPage=1000

returns a client with the MAC de:89:c2 ...

 

Weird.

PhilipDAth
Kind of a big deal
Kind of a big deal

The mac partial match absolutely works.  It is finding the Raspberry Pis in networks that exist, and it is working on network with much less clients and no Raspberry Pis, it just doesn't work on networks with lots of clients (such as 20k) and no Raspberry Pis.

RaphaelL
Kind of a big deal
Kind of a big deal

Well it is not working for me and the network has less than 500 clients, but it returns a http 200. That's weird.

PhilipDAth
Kind of a big deal
Kind of a big deal

Note that the query defaults to looking at the last 24 hours of data.  You might need to add something like "timespan=604800" (for 7 days) to get your query to work.

 

This API looks like it has a bug when processing filters.

PhilipDAth
Kind of a big deal
Kind of a big deal

@John_on_API , this anomalous behaviour using filters with getNetworkClients would be a good project for someone to fix.  🙂

John_on_API
Meraki Employee
Meraki Employee

If you are experiencing this issue, please contact Meraki Support to resolve.

Prasoon
Conversationalist

I'm facing a similar issue. I'm making a call to the sm/profiles profiles to fetch all the profiles within a network but I'm getting 504 Gateway Timeout 3/10 times. The calls which are succeeding are also taking 55-57 seconds every time.

Also, there are no query params to fetch the profiles in parts. I'm fetching close to 2000 profiles here.

John_on_API
Meraki Employee
Meraki Employee

Please open a case with Meraki Support, especially if you have a means of reproducing the issue on-demand!

Get notified when there are additional replies to this discussion.