Automated Health Check

MikeyJ
Just browsing

Automated Health Check

Hi all,

 

I'm currently working on automation of template changes for devices. Currently when changing templates, the devices lose their local settings, so the script we have written will pull things like current bandwidth shaping, vlans, uplink IPs, etc. and push them to the device after changing the assigned template.

 

What I am trying to do now is build in some health checking to this. When I run it now, it will confirm if the MX has taken the configuration, but as we are aware the devices can take 5+ minutes to take the configuration from the cloud occasionally. When this is complete, I want to ensure that clients behind the MX are working correctly. Is anyone aware of or has anyone created something that will pull clients from a list of networks and ping them? The current goal would be to run this once prior to doing the template migration, then a second time afterwards and do a diff over the two outputs.

 

Thanks!

3 Replies 3
Andrewbluepiano
Getting noticed

@MikeyJ 

 

All sounds perfectly doable. Take that automation script you have already made for deployment, then wrap it up in a script that first generates the baseline network status report, runs your changes, then waits for the amount of time you want, time.sleep(300), then runs the same reporting script and compares the output. 

 

A quick way to do this would be to run a ping over your entire subnet, which would trigger some activity on any connected clients. Then you should be able to run a report through the dashboard API checking for clients with activity during that last timeframe. https://dashboard.meraki.com/api_docs/v0#list-the-clients-that-have-used-this-network-in-the-timespa...

 

 

But it might be easier and more accurate to simply record the results of the ping in whatever language you're using to run it, and generate a report based on that. When it comes to reporting things that are sensitive to time with a precision under 5 minutes, some API's don't exactly work perfectly, but some do.

damienleick
Getting noticed

@MikeyJ  I'm very intrested about your script to switch a network to another template.

 

Is there a possibilty of sharing source code ?

NetworkLarry
Getting noticed

Regarding pinging the clients, use the "get clients" API call to obtain a list of clients in the last x time frame.  When I did this, I used 2 hours (7200secs).  If you are using Python, use the ping() function from the Ping3 package on Pypi. Adjust the following accordingly for your purpose.

 

clientvalidationlist = []

clients = Merakiclient.clients.getNetworkClients(network['id'], timespan = 7200)

for client in clients:

if ping(client['ip']) != None:

clientvalidationlist.append({'mfg': client['manufacturer'], 'desc': client['description'], 'ip': client['ip']})

print('Clients responding to ping: {}'.format(len(clientvalidationlist)))

 

later in the program use the same concept, except use "for client in clientvalidationlist".

 

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.