Getting AP down time over reporting period.

DevilWAH
Here to help

Getting AP down time over reporting period.

Hi, 

 

can anyone help me with how i can find the total down time (or time spent in a status) for an AP over a time period? 

 

dashboard.organizations.getOrganizationDevicesStatuses(org_id, productTypes=['wireless'], total_pages='all')

 

Will give the current status, but i want to be able to see how long and how many times an AP has gone of line in the last week? If i am running the report once per week I not only want to know the current AP status but the history for the last time period. 

 

The code below could be nicer but it was a simple way to pull back the numbers of AP in each start for each network. but as i say it's only when the Script runs it doesn't provide the history I need. 

 

Is there any way i can find per device the status changes and time stamps or other way where i could work this out? 

 

Thank you 

 

networks = dashboard.organizations.getOrganizationNetworks(org_id)
ndevices = dashboard.organizations.getOrganizationDevicesStatuses(org_id, productTypes=['wireless'], total_pages='all')

for net in networks:

       numon = len(list({v['name']: v for v in ndevices if (v["status"] == "online") & (v["networkId"] == net["id"]) }.values()))
       numalert = len(list({v['name']: v for v in ndevices if (v["status"] == "alerting") & (v["networkId"] == net["id"])                      }.values()))
        numdormant = len(list({v['name']: v for v in ndevices if (v["status"] == "dormant") & (v["networkId"] ==                            net["id"])}.values()))
        numoff = len(list({v['name']: v for v in ndevices if (v["status"] == "offline") & (v["networkId"] == net["id"])}.values()))

 

 

5 Replies 5
sungod
Kind of a big deal

The way I do it is run a script using getOrganizationDevicesStatuses every five minutes via a cronjob, and build a status history throughout the day, these can then be combined to cover longer periods for reporting/analysis.

 

To reduce amount of data, I only get all status values at start/end of day i.e.including 'online' status, and in between use the statuses[] parameter to limit data to only devices with status offline/dormant/alerting.

 

It's inevitable that over many days/weeks/months some of the runs will fail due to a network/other issue, you need to code to handle that, in my case I just ignore the odd 'lost' five minutes.

 

DevilWAH
Here to help

I thought of that but that defeats the purpose of running a single vendor agnostic monthly reporting scrip (Actually running weekly and combining) for all our separate wireless deployments. As the meraki dashboard shows the AP connectivity history of the AP it must be stored with in the data meraki hold so it would be nice to get to it via API. I was going to look at the events as I think they also have AP up/down so maybe can parse this and count the status changes and time stamps. 

 

I might see if this data is in DNA as we also monitor the Meraki AP's in that. 

 

 

sungod
Kind of a big deal

As things stand, the iterative method is the only way I found to do it via API. Not ideal, but it works.

 

Fyi there is a request I made through the API early-access group to provide an API call that would return longer term availability data, if Meraki decide to do it, one day it'll appear.

 

This is a limitation I've found on other orchestrators, at least Meraki gives a good unambiguous status, there are some that can't even do that!

 

Depends on your management infrastructure, you might be able to use other ways to determine availability...  https://documentation.meraki.com/General_Administration/Monitoring_and_Reporting/Meraki_Device_Repor...

 

 

JasonM
Meraki Employee
Meraki Employee

Just a suggestion but would webhooks be useful in this use case? That way it is a push method rather than pull. As long as you have alerts setup for all wireless networks to notify when an AP goes offline you should be able to track that on your required interval and calc the time difference between the down and up notifications for each serial and/or mac address. It will save on your API budget as well.

DevilWAH
Here to help

This has the same issue there needs to be something to capture the hooks, store the data and then create a report at the end of the week / month. And this is what i am trying to avoid we have a number of tools that check AP status and so i could for example use a call to Solarwind to get the AP up / down time. But i was curious if there was a way to do native in meraki.

 

And it looks like you can do it using the network alerts history and network devices. 

 


results = dashboard.networks.getNetworkAlertsHistory(net["id"], perPage = 1000, total_pages='all')

 

 

for net in networks:
results = dashboard.networks.getNetworkAlertsHistory(net["id"], perPage = 1000, total_pages='all')
print (results)
deviceevent = (event for event in results if event["device"]["serial"] == "xxxxxxxxxx")
for event in deviceevent:
print (f' Time start {event["occurredAt"]} type {event["alertType"]}')
print

 

gives the events for an AP and only needs 2 calls per network. Then it's not too hard to loop through this and for a specified time range count the down time per AP. 

 

Time start 2023-02-13T10:05:24Z type An access point came up
Time start 2023-02-10T23:25:20Z type An access point went down
Time start 2023-02-05T17:07:55Z type An access point came up
Time start 2023-02-01T00:21:30Z type An access point went down

Get notified when there are additional replies to this discussion.