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.
Hi Phil ,
I suppose the MAC has to be in the format xx:xx:xx:yy:yy:yy and not just with the OUI.
A partial match is at least supported based on the documentation.
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.
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.
Well it is not working for me and the network has less than 500 clients, but it returns a http 200. That's weird.
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.
@John_on_API , this anomalous behaviour using filters with getNetworkClients would be a good project for someone to fix. 🙂
If you are experiencing this issue, please contact Meraki Support to resolve.
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.
Please open a case with Meraki Support, especially if you have a means of reproducing the issue on-demand!