[Python & Dashboard API] Simple event log counter

Here to help

[Python & Dashboard API] Simple event log counter

Hello everyone, 


I'd like to share a project I made when I needed to get a simple count of DFS events on my wireless networks on a defined timespan (in days) , for a specific netID or the whole organization, for a specific type of device.


You can add into parameters the type of event you want to monitor (here for example : dfs_event)




You can get the script here : https://github.com/gabtoub/getMerakiEventCount/

Feel free to discuss or share your advices/remarks about this script,




3 Replies 3
Kind of a big deal
Kind of a big deal

Great idea!

Head in the Cloud

Nice Idea.


I have a few comments about the implementation of the script:


  1. Use only one session object and pass it as parameter instead of the apikey. At the moment you are generating for each request a new session object which generates a higher load on your script and on the meraki backend
  2. span argument: add the default parameter. That way you won't have to check, if it got provided or not. Just use it 😃
  3. At the moment you are not checking for an invalid input on the parameters, so your code might fail. Try something like this:





        variables = var_parser.parse_args()
    except SystemExit:
        print("could not parse arguments")





  • don't check for the api_key. The DashboardAPI object will do this for you. Just catch the APIKeyError exception.
  • in getnbevents you don't have to count the entries, just do return len(log['events'])


return len(log['events'])​


Thanks @Greenberet , I'll try this today and update the script with your advices 🙂

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.